Skip to content

Instantly share code, notes, and snippets.

@t-mart
Created March 14, 2013 22:52
Show Gist options
  • Save t-mart/5165953 to your computer and use it in GitHub Desktop.
Save t-mart/5165953 to your computer and use it in GitHub Desktop.
good way to get time data
#!/bin/bash
#strace
# "-e trace=some_syscall" allows you to trace just the syscalls you want.
# lotta noise otherwise. comma separated list, but
# for our experiments, it'll prolly just be 1
# syscall
# "-T" give us time data
#
# "program arg0 arg1" is the program we want to trace. this'll likely be
# something we write that does hundreds of a particular
# syscall
#
# "2>&1" strace outputs to stderr by default. we don't want that because
# we're processing later to a pipe. this says to redirect to stdout
#grep
# "--extended-grep" use more robust regexp language "--regexp" the pattern
#
# "--only-matching" don't return whole lines, just the match
#>> blah.txt outputs to blah.txt. name this to something more specific like
# "mkdir_tests.txt" or whatnot.
strace -e trace=some_syscall -T program arg0 arg1 2>&1 | grep --extended-regexp -regexp="[[:digit:]]\.[[:digit:]]+" --only-matching >> blah.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment