Skip to content

Commit

Permalink
Remove -u short form, use only --utc (code review)
Browse files Browse the repository at this point in the history
  • Loading branch information
amdn committed May 28, 2019
1 parent e5d3293 commit 471f6ab
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions man/man8/exitsnoop.8
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.SH NAME
exitsnoop \- Trace all process termination (exit, fatal signal). Uses Linux eBPF/bcc.
.SH SYNOPSIS
.B exitsnoop [\-h] [\-t] [\-u] [\-x] [\-p PID] [\-\-label LABEL]
.B exitsnoop [\-h] [\-t] [\-\-utc] [\-x] [\-p PID] [\-\-label LABEL]
.SH DESCRIPTION
exitsnoop traces process termination, showing the command name and reason for
termination, either an exit or a fatal signal.
Expand All @@ -24,7 +24,7 @@ Print usage message.
\-t
Include a timestamp column.
.TP
\-u
\-\-utc
Include a timestamp column, use UTC timezone.
.TP
\-x
Expand Down Expand Up @@ -60,7 +60,7 @@ Label each output line with 'EXIT':
.TP
TIME-TZ
Time of process termination HH:MM:SS.sss with milliseconds, where TZ is
the local time zone, 'UTC' with \-u option.
the local time zone, 'UTC' with \-\-utc option.
.TP
LABEL
The optional label if \-\-label option is used. This is useful with the
Expand Down
4 changes: 2 additions & 2 deletions tools/exitsnoop.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
exitsnoop # trace all process termination
exitsnoop -x # trace only fails, exclude exit(0)
exitsnoop -t # include timestamps (local time)
exitsnoop -u # include timestamps (UTC)
exitsnoop --utc # include timestamps (UTC)
exitsnoop -p 181 # only trace PID 181
exitsnoop --label=exit # label each output line with 'exit'
"""
Expand Down Expand Up @@ -58,7 +58,7 @@ def _getParser():
epilog=_examples)
a=parser.add_argument
a("-t", "--timestamp", action="store_true", help="include timestamp (local time default)")
a("-u", "--utc", action="store_true", help="include timestamp in UTC (-t implied)")
a("--utc", action="store_true", help="include timestamp in UTC (-t implied)")
a("-p", "--pid", help="trace this PID only")
a("--label", help="label each line")
a("-x", "--failed", action="store_true", help="trace only fails, exclude exit(0)")
Expand Down
12 changes: 6 additions & 6 deletions tools/exitsnoop_example.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ of the process with hundredth of a second resolution, and the reason for
the process exit (EXIT_CODE).

A -t option can be used to include a timestamp column, it shows local time
by default. The -u option shows the time in UTC. The --label
by default. The --utc option shows the time in UTC. The --label
option adds a column indicating the tool that generated the output,
'exit' by default. If other tools follow this format their outputs
can be merged into a single trace with a simple lexical sort
Expand All @@ -46,12 +46,12 @@ e.g. 'exec', 'open', 'exit', etc. Time is displayed with millisecond
resolution. The -x option will show only non-zero exits and fatal
signals, which excludes processes that exit with 0 code:

# ./exitsnoop.py -t -u -x --label= > exitlog &
# ./exitsnoop.py -t --utc -x --label= > exitlog &
[1] 18289
# for((i=65;i<100;i+=5)); do bash -c "sleep 1.$i;exit $i"; done
^C
# fg
./exitsnoop.py -t -u -x --label= > exitlog
./exitsnoop.py -t --utc -x --label= > exitlog
^C
# cat exitlog
TIME-UTC LABEL PCOMM PID PPID TID AGE(s) EXIT_CODE
Expand All @@ -67,14 +67,14 @@ TIME-UTC LABEL PCOMM PID PPID TID AGE(s) EXIT_CODE
USAGE message:

# ./exitsnoop.py -h
usage: exitsnoop.py [-h] [-t] [-u] [-p PID] [--label LABEL] [-x]
usage: exitsnoop.py [-h] [-t] [--utc] [-p PID] [--label LABEL] [-x]

Trace all process termination (exit, fatal signal)

optional arguments:
-h, --help show this help message and exit
-t, --timestamp include timestamp (local time default)
-u, --utc include timestamp in UTC (-t implied)
--utc include timestamp in UTC (-t implied)
-p PID, --pid PID trace this PID only
--label LABEL label each line
-x, --failed trace only fails, exclude exit(0)
Expand All @@ -83,7 +83,7 @@ examples:
exitsnoop # trace all process termination
exitsnoop -x # trace only fails, exclude exit(0)
exitsnoop -t # include timestamps (local time)
exitsnoop -u # include timestamps (UTC)
exitsnoop --utc # include timestamps (UTC)
exitsnoop -p 181 # only trace PID 181
exitsnoop --label=exit # label each output line with 'exit'

Expand Down

0 comments on commit 471f6ab

Please sign in to comment.