bcc
bcc copied to clipboard
opensnoop more options
Just realized opensnoop.py is missing a few useful options.
perf-tools version:
/apps/perf-tools/bin# ./opensnoop -h
USAGE: opensnoop [-htx] [-d secs] [-p PID] [-n name] [filename]
-d seconds # trace duration, and use buffers
-n name # process name to match on I/O issue
-p PID # PID to match on I/O issue
-t # include time (seconds)
-x # only show failed opens
-h # this usage message
filename # match filename (partials, REs, ok)
eg,
opensnoop # watch open()s live (unbuffered)
opensnoop -d 1 # trace 1 sec (buffered)
opensnoop -p 181 # trace I/O issued by PID 181 only
opensnoop conf # trace filenames containing "conf"
opensnoop 'log$' # filenames ending in "log"
See the man page and example file for more info.
current bcc version:
/mnt/src/bcc/tools# ./opensnoop.py -h
usage: opensnoop.py [-h] [-t] [-x] [-p PID]
Trace open() syscalls
optional arguments:
-h, --help show this help message and exit
-t, --timestamp include timestamp on output
-x, --failed only show failed opens
-p PID, --pid PID trace this PID only
examples:
./opensnoop # trace all open() syscalls
./opensnoop -t # include timestamps
./opensnoop -x # only show failed opens
./opensnoop -p 181 # only trace PID 181
They don't have to perfectly match. Eg, might be better to do a string match instead of an RE, if the string match can be done in kernel context. And the -d for duration and buffers, well, I think we're already using buffers.
I will take a look at this.
Looking at the latest version of opensnoop.py, it looks like contributions by Dina Goldshtein, Tim Douglas, Takuma Kume, and Rocky Xing solved this lack of options.
Thanks @matthew-olson-intel , closing ticket.