Skip to content

Commit 5888989

Browse files
brendangregggoldshtn
authored andcommitted
stackcount: add -K, -U, -d, -D, and -f (iovisor#1335)
* stackcount: add -K and -U * stackcount: add -D for duration * stackcount: add -f for folded output
1 parent d9641be commit 5888989

File tree

3 files changed

+788
-331
lines changed

3 files changed

+788
-331
lines changed

man/man8/stackcount.8

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
.SH NAME
33
stackcount \- Count function calls and their stack traces. Uses Linux eBPF/bcc.
44
.SH SYNOPSIS
5-
.B stackcount [\-h] [\-p PID] [\-i INTERVAL] [\-T] [\-r] [\-s]
6-
[\-P] [\-v] [\-d] pattern
5+
.B stackcount [\-h] [\-p PID] [\-i INTERVAL] [\-D DURATION] [\-T] [\-r] [\-s]
6+
[\-P] [\-K] [\-U] [\-v] [\-d] [\-f] pattern
77
.SH DESCRIPTION
88
stackcount traces functions and frequency counts them with their entire
9-
stack trace, summarized in-kernel for efficiency. This allows higher
10-
frequency events to be studied. The output consists of unique stack traces,
11-
and their occurrence counts. In addition to kernel and user functions, kernel
12-
tracepoints and USDT tracepoint are also supported.
9+
stack trace, kernel stack and user stack, summarized in-kernel for efficiency.
10+
This allows higher frequency events to be studied. The output consists of
11+
unique stack traces, and their occurrence counts. In addition to kernel and
12+
user functions, kernel tracepoints and USDT tracepoint are also supported.
1313

1414
The pattern is a string with optional '*' wildcards, similar to file globbing.
1515
If you'd prefer to use regular expressions, use the \-r option.
@@ -38,11 +38,19 @@ Include a timestamp with interval output.
3838
Show raw addresses.
3939
.TP
4040
\-d
41+
Print a delimiter ("--") in-between the kernel and user stacks.
42+
.TP
43+
\-\-debug
4144
Print the source of the BPF program when loading it (for debugging purposes).
4245
.TP
4346
\-i interval
4447
Summary interval, in seconds.
4548
.TP
49+
\-D duration
50+
Total duration of trace, in seconds.
51+
\-f
52+
Folded output format.
53+
.TP
4654
\-p PID
4755
Trace this process ID only (filtered in-kernel).
4856
.TP
@@ -52,47 +60,59 @@ A function name, or a search pattern. Can include wildcards ("*"). If the
5260
\-r option is used, can include regular expressions.
5361
.SH EXAMPLES
5462
.TP
55-
Count kernel stack traces for submit_bio():
63+
Count kernel and user stack traces for submit_bio():
5664
#
5765
.B stackcount submit_bio
5866
.TP
59-
Count kernel stack traces for ip_output():
67+
Count stacks with a delimiter for submit_bio():
68+
#
69+
.B stackcount \-d submit_bio
70+
.TP
71+
Count kernel stack trace only for submit_bio():
72+
#
73+
.B stackcount \-K submit_bio
74+
.TP
75+
Count user stack trace only for submit_bio():
76+
#
77+
.B stackcount \-U submit_bio
78+
.TP
79+
Count stack traces for ip_output():
6080
#
6181
.B stackcount ip_output
6282
.TP
6383
Show symbol offsets:
6484
#
65-
.B stackcount -s ip_output
85+
.B stackcount \-s ip_output
6686
.TP
6787
Show offsets and raw addresses (verbose):
6888
#
69-
.B stackcount -sv ip_output
89+
.B stackcount \-sv ip_output
7090
.TP
71-
Count kernel stacks for kernel functions matching tcp_send*:
91+
Count stacks for kernel functions matching tcp_send*:
7292
#
7393
.B stackcount 'tcp_send*'
7494
.TP
7595
Same as previous, but using regular expressions:
7696
#
77-
.B stackcount -r '^tcp_send.*'
97+
.B stackcount \-r '^tcp_send.*'
7898
.TP
7999
Output every 5 seconds, with timestamps:
80100
#
81-
.B stackcount -Ti 5 ip_output
101+
.B stackcount \-Ti 5 ip_output
82102
.TP
83103
Only count stacks when PID 185 is on-CPU:
84104
#
85-
.B stackcount -p 185 ip_output
105+
.B stackcount \-p 185 ip_output
86106
.TP
87107
Count user stacks for dynamic heap allocations with malloc in PID 185:
88108
#
89-
.B stackcount -p 185 c:malloc
109+
.B stackcount \-p 185 c:malloc
90110
.TP
91111
Count user stacks for thread creation (USDT tracepoint) in PID 185:
92112
#
93-
.B stackcount -p 185 u:pthread:pthread_create
113+
.B stackcount \-p 185 u:pthread:pthread_create
94114
.TP
95-
Count kernel stacks for context switch events using a kernel tracepoint:
115+
Count stacks for context switch events using a kernel tracepoint:
96116
#
97117
.B stackcount t:sched:sched_switch
98118
.SH OVERHEAD

0 commit comments

Comments
 (0)