bcc icon indicating copy to clipboard operation
bcc copied to clipboard

opensnoop more options

Open brendangregg opened this issue 10 years ago • 3 comments

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.

brendangregg avatar Jul 15 '16 20:07 brendangregg

I will take a look at this.

mcaleavya avatar Nov 28 '16 21:11 mcaleavya

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.

matthew-olson-intel avatar Oct 10 '23 22:10 matthew-olson-intel

Thanks @matthew-olson-intel , closing ticket.

brendangregg avatar Oct 11 '23 00:10 brendangregg