funcinterval(8)
β¨ funcinterval(8) β the time-gap tracker β¨
π NAME
funcinterval - Time interval between the same function, tracepoint as a histogram. π
πΈ SYNOPSIS
funcinterval [-h] [-p PID] [-i INTERVAL] [-d DURATION] [-T] [-u] [-m]
[-v] pattern
π¦ DESCRIPTION
okay so this tool times the interval between the same function, and shows it to you as a histogram πβ¨
bestie, eBPF/bcc is literally made for platform performance tuning π With funclatency, we can profile specific functions to see how much latency a function costs. BUT lowkey, sometimes the performance drop isn't about how long a function takes, it's about the gap between function calls π That's the whole reason funcinterval exists. It's giving purpose π§
This tool uses in-kernel eBPF maps for storing timestamps and the histogram, for efficiency. The way that it keeps everything in the kernel is so smart ngl π«Ά
β οΈ 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. Not me saying this with a straight face, but please be careful π
Since this uses BPF, only the root user can use this tool. No root, no tool, periodt π
π REQUIREMENTS
CONFIG_BPF and bcc. π
β¨ OPTIONS β¨
patternβ the function name you want to watch π-hβ prints the usage message, for when you forget everything π-p PIDβ only trace this process ID. Main character energy π-i INTERVALβ print output every INTERVAL seconds π-d DURATIONβ total duration of the trace, in seconds β³-Tβ slap timestamps onto the output π°οΈ-uβ output the histogram in microseconds πΈ-mβ output the histogram in milliseconds π-vβ print the BPF program, for debugging purposes π§ββοΈ
π EXAMPLES β¨
Time the interval of the do_sys_open() kernel function as a histogram:
# funcinterval do_sys_open
Time the interval of xhci_ring_ep_doorbell(), in microseconds:
# funcinterval -u xhci_ring_ep_doorbell
Time the interval of do_nanosleep(), in milliseconds:
# funcinterval -m do_nanosleep
Output every 5 seconds, with timestamps:
# funcinterval -mTi 5 vfs_read
Time process 181 only:
# funcinterval -p 181 vfs_read
Time the interval of the mm_vmscan_direct_reclaim_begin tracepoint:
# funcinterval t:vmscan:mm_vmscan_direct_reclaim_begin
Time the interval of c:malloc used by top every 3 seconds:
# funcinterval -p `pidof -s top` -i 3 c:malloc
Time the /usr/local/bin/python main function:
# funcinterval /usr/local/bin/python:main
π FIELDS π
necsβ nanosecond range π«usecsβ microsecond range π·msecsβ millisecond range πcountβ how many calls fell into this range π’distributionβ an ASCII bar chart to visualize the distribution (count column) π
π«§ OVERHEAD π«§
This traces kernel functions and maintains in-kernel timestamps and a histogram, which are asynchronously copied to user-space. While this method is very efficient, the rate of kernel functions can also be very high (>1M/sec), at which point the overhead is expected to be measurable. Measure in a test environment and understand overheads before use π§ͺ You can also use funccount to measure the rate of kernel functions over a short duration, to set some expectations before use.
π SOURCE π
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. Bestie, that file is a goldmine ππ
π OS π
Linux
π§ STABILITY π§
Unstable - in development.
π AUTHOR π
Edward Wu
π SEE ALSO π
Bye bestie, go trace something iconic π¦πβ¨ funcinterval(8), USER COMMANDS, bcc-era 2020-05-27 vibes πΈπ«Ά
π¦ where this page comes from
- alpine 3.24: bcc-doc 0.36.1-r1 Β· Apache-2.0
- nixpkgs unstable: bcc 0.37.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms