Skip to content

Commit

Permalink
stackcount: add -K, -U, -d, -D, and -f (iovisor#1335)
Browse files Browse the repository at this point in the history
* stackcount: add -K and -U

* stackcount: add -D for duration

* stackcount: add -f for folded output
  • Loading branch information
brendangregg authored and goldshtn committed Sep 3, 2017
1 parent d9641be commit 5888989
Show file tree
Hide file tree
Showing 3 changed files with 788 additions and 331 deletions.
54 changes: 37 additions & 17 deletions man/man8/stackcount.8
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
.SH NAME
stackcount \- Count function calls and their stack traces. Uses Linux eBPF/bcc.
.SH SYNOPSIS
.B stackcount [\-h] [\-p PID] [\-i INTERVAL] [\-T] [\-r] [\-s]
[\-P] [\-v] [\-d] pattern
.B stackcount [\-h] [\-p PID] [\-i INTERVAL] [\-D DURATION] [\-T] [\-r] [\-s]
[\-P] [\-K] [\-U] [\-v] [\-d] [\-f] pattern
.SH DESCRIPTION
stackcount traces functions and frequency counts them with their entire
stack trace, summarized in-kernel for efficiency. This allows higher
frequency events to be studied. The output consists of unique stack traces,
and their occurrence counts. In addition to kernel and user functions, kernel
tracepoints and USDT tracepoint are also supported.
stack trace, kernel stack and user stack, summarized in-kernel for efficiency.
This allows higher frequency events to be studied. The output consists of
unique stack traces, and their occurrence counts. In addition to kernel and
user functions, kernel tracepoints and USDT tracepoint are also supported.

The pattern is a string with optional '*' wildcards, similar to file globbing.
If you'd prefer to use regular expressions, use the \-r option.
Expand Down Expand Up @@ -38,11 +38,19 @@ Include a timestamp with interval output.
Show raw addresses.
.TP
\-d
Print a delimiter ("--") in-between the kernel and user stacks.
.TP
\-\-debug
Print the source of the BPF program when loading it (for debugging purposes).
.TP
\-i interval
Summary interval, in seconds.
.TP
\-D duration
Total duration of trace, in seconds.
\-f
Folded output format.
.TP
\-p PID
Trace this process ID only (filtered in-kernel).
.TP
Expand All @@ -52,47 +60,59 @@ A function name, or a search pattern. Can include wildcards ("*"). If the
\-r option is used, can include regular expressions.
.SH EXAMPLES
.TP
Count kernel stack traces for submit_bio():
Count kernel and user stack traces for submit_bio():
#
.B stackcount submit_bio
.TP
Count kernel stack traces for ip_output():
Count stacks with a delimiter for submit_bio():
#
.B stackcount \-d submit_bio
.TP
Count kernel stack trace only for submit_bio():
#
.B stackcount \-K submit_bio
.TP
Count user stack trace only for submit_bio():
#
.B stackcount \-U submit_bio
.TP
Count stack traces for ip_output():
#
.B stackcount ip_output
.TP
Show symbol offsets:
#
.B stackcount -s ip_output
.B stackcount \-s ip_output
.TP
Show offsets and raw addresses (verbose):
#
.B stackcount -sv ip_output
.B stackcount \-sv ip_output
.TP
Count kernel stacks for kernel functions matching tcp_send*:
Count stacks for kernel functions matching tcp_send*:
#
.B stackcount 'tcp_send*'
.TP
Same as previous, but using regular expressions:
#
.B stackcount -r '^tcp_send.*'
.B stackcount \-r '^tcp_send.*'
.TP
Output every 5 seconds, with timestamps:
#
.B stackcount -Ti 5 ip_output
.B stackcount \-Ti 5 ip_output
.TP
Only count stacks when PID 185 is on-CPU:
#
.B stackcount -p 185 ip_output
.B stackcount \-p 185 ip_output
.TP
Count user stacks for dynamic heap allocations with malloc in PID 185:
#
.B stackcount -p 185 c:malloc
.B stackcount \-p 185 c:malloc
.TP
Count user stacks for thread creation (USDT tracepoint) in PID 185:
#
.B stackcount -p 185 u:pthread:pthread_create
.B stackcount \-p 185 u:pthread:pthread_create
.TP
Count kernel stacks for context switch events using a kernel tracepoint:
Count stacks for context switch events using a kernel tracepoint:
#
.B stackcount t:sched:sched_switch
.SH OVERHEAD
Expand Down
Loading

0 comments on commit 5888989

Please sign in to comment.