-h Print usage message.
-r Allow regular expressions for the search pattern. The default allows "*" wildcards only.
-s Show address offsets.
-P Display stacks separately for each process.
-K Show kernel stack only.
-U Show user stack only.
-T Include a timestamp with interval output.
-v Show raw addresses.
-d Print a delimiter ("--") in-between the kernel and user stacks.
--debug Print the source of the BPF program when loading it (for debugging purposes).
-i interval Summary interval, in seconds.
-D duration Total duration of trace, in seconds. -f Folded output format.
-p PID Trace this process ID only (filtered in-kernel).
-c CPU Trace this CPU only (filtered in-kernel).
pattern A function name, or a search pattern. Can include wildcards ("*"). If the -r option is used, can include regular expressions.
Count kernel and user stack traces for submit_bio(): # stackcount submit_bio
Count stacks with a delimiter for submit_bio(): # stackcount -d submit_bio
Count kernel stack trace only for submit_bio(): # stackcount -K submit_bio
Count user stack trace only for submit_bio(): # stackcount -U submit_bio
Count stack traces for ip_output(): # stackcount ip_output
Show symbol offsets: # stackcount -s ip_output
Show offsets and raw addresses (verbose): # stackcount -sv ip_output
Count stacks for kernel functions matching tcp_send*: # stackcount 'tcp_send*'
Same as previous, but using regular expressions: # stackcount -r '^tcp_send.*'
Output every 5 seconds, with timestamps: # stackcount -Ti 5 ip_output
Only count stacks when PID 185 is on-CPU: # stackcount -p 185 ip_output
Only count stacks for CPU 1: # stackcount -c 1 put_prev_entity
Count user stacks for dynamic heap allocations with malloc in PID 185: # stackcount -p 185 c:malloc
Count user stacks for thread creation (USDT tracepoint) in PID 185: # stackcount -p 185 u:pthread:pthread_create
Count stacks for context switch events using a kernel tracepoint: # stackcount t:sched:sched_switch
Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool.