DOKK / manpages / debian 11 / bpfcc-tools / funccount-bpfcc.8.en
funccount(8) System Manager's Manual funccount(8)

funccount - Count function, tracepoint, and USDT probe calls matching a pattern. Uses Linux eBPF/bcc.

funccount [-h] [-p PID] [-i INTERVAL] [-d DURATION] [-T] [-r] [-D] pattern

This tool is a quick way to determine which functions are being called, and at what rate. It uses in-kernel eBPF maps to count function calls.

WARNING: This uses dynamic tracing of (what can be many) functions, an activity that has had issues on some kernel versions (risk of panics or freezes). Test, and know what you are doing, before use.

Since this uses BPF, only the root user can use this tool.

CONFIG_BPF and bcc.

pattern Search pattern. Supports "*" wildcards. See EXAMPLES. You can also use -r for regular expressions.

Print usage message.
Trace this process ID only.
Print output every interval seconds.
Total duration of trace in seconds.
Include timestamps on output.
Use regular expressions for the search pattern.
Print the BPF program before starting (for debugging purposes).
Trace on this CPU only.

# funccount 'vfs_*'
# funccount 'tcp_send*'
# funccount -i 1 'vfs_*'
# funccount -d 10 'vfs_*'
# funccount -r '^vfs_.*'
# funccount -p 181 'vfs_*'
# funccount t:sched:sched_fork
# funccount -p 185 u:node:gc*
# funccount c:malloc
# funccount -c 1 'vfs_*'

Function name
Number of calls while tracing

This traces functions and maintains in-kernel counts, which are asynchronously copied to user-space. While the rate of calls be very high (>1M/sec), this is a relatively efficient way to trace these events, and so the overhead is expected to be small for normal workloads. Measure in a test environment before use.

This is from bcc.

https://github.com/iovisor/bcc

Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool.

Linux

Unstable - in development.

Brendan Gregg, Sasha Goldshtein

stackcount(8) funclatency(8) vfscount(8)

2015-08-18 USER COMMANDS