funcslower(8)
πΈ NAME πΈ
okay bestie, welcome to funcslower(8) from the System Manager's Manual β the icon of tracing slow kernel or user function calls. The name is funcslower, and the job is literally: trace slow kernel or user function calls. That's it. That's the mission. π
β¨ SYNOPSIS β¨
funcslower [-hf] [-p PID] [-U | -K] [-m MIN_MS] [-u MIN_US] [-a
ARGUMENTS] [-T] [-t] [-v] function [function ...]
π DESCRIPTION π
This script traces a kernel or user function's entry and return points, and prints a message when the function's latency exceeded the specified threshold. Multiple functions are supported, and you can mix kernel functions with user functions in different libraries. versatile queen behavior β¨
WARNING: See the OVERHEAD section. Do not skip it, bestie, I'm serious.
By default, a minimum millisecond threshold of 1 is used. Recursive functions are not supported: only the inner-most recursive invocation will be traced. iykyk π
Since this uses BPF, only the root user can use this tool. No cap.
π§ REQUIREMENTS π§
CONFIG_BPF and bcc. That's the whole requirements list. Short, sweet, slay. π
π OPTIONS π
-p PIDβ trace this PID only. Just this one. main character PID energy.-m MIN_NSβ minimum duration to trace, in milliseconds. Default is1 ms. (Yes, the option line literally saysMIN_NSwhile the synopsis saysMIN_MS, and the description says milliseconds β I am keeping every bit exact, bestie. No fixing, only preserving. π)-u MIN_USβ minimum duration to trace, in microseconds.-a ARGUMENTSβ print the function's arguments, up to6. Six little argument besties, max.-Tβ print aHH:MM:SStimestamp with each entry.-tβ print a seconds timestamp with each entry, at microsecond resolution.-fβ print output in folded stack format.-Uβ show stacks from user space only (no kernel space stacks).-Kβ show stacks from kernel space only (no user space stacks).-vβ print the resulting BPF program, for debugging purposes. debug girlies rise π οΈ-hβ it appears in the synopsis as part of[-hf], but the original OPTIONS section does not give it its own paragraph, so I am not inventing behavior for it. You still see it here, bestie. πfunctionβ the function to trace -- multiple functions are supported. If a plain function name is provided, the function is assumed to be a kernel function. For user functions, provide the library name and the function name, e.g.bash:readlineorc:malloc.
π₯ EXAMPLES π₯
Trace vfs_write calls slower than 1ms:
# funcslower vfs_write
Trace open() calls in libc slower than 10us:
# funcslower -u 10 c:open
Trace both malloc() and free() slower than 10us, in pid 135 only:
# funcslower -p 135 -u 10 c:malloc c:free
Trace the write syscall and print its first 4 arguments:
# funcslower -a 4 SyS_write
Trace opens from libc and print the user and kernel stack frames:
# funcslower -UK c:open
every example preserved, every command exact, no crumbs left behind π
π¦ FIELDS π¦
TIMEβ time of the event as a human-readableHH:MM:SSformat, or a timestamp in seconds at microsecond-accuracy from the first event seen.COMMβ process name.PIDβ process ID.LATβ latency of the operation in either microseconds (us) or milliseconds (ms).RVALβ the return value from the function. Often useful for diagnosing a relationship between slow and failed function calls.FUNCβ the function name, followed by its arguments if requested.
π OVERHEAD π
Depending on the function(s) being traced, overhead can become severe. For example, tracing a common function like malloc() can slow down a C/C++ program by a factor of 2 or more. On the other hand, tracing a low-frequency event like the SyS_setreuid() function will probably not be as prohibitive, and in fact negligible for functions that are called up to 100-1000 times per second. choose your traced functions wisely, bestie π«
You should first use the funclatency and argdist tools for investigation, because they summarize data in-kernel and have a much lower overhead than this tool. To get a general idea of the number of times a particular function is called (and estimate the overhead), use the funccount tool, e.g.:
# funccount c:open
Fr fr: this tool can get heavy. Start with the low-overhead summarizers first, then come back. π
π 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. homework but make it cute π
π§ OS π§
Linux. Obviously. π§π
β STABILITY β
Unstable - in development. she's growing, she's evolving, she's in development π¦
π AUTHOR π
Sasha Goldshtein. Icon behavior. π
π SEE ALSO π
funccount(8), funclatency(8), argdist(8), trace(8). Go read the whole friend group. π
okay that's the whole page, bestie β cute little sign-off with USER COMMANDS, dated 2017-03-30, officially funcslower(8). mwah πβ¨
π¦ where this page comes from
- alpine 3.24: bcc-doc 0.36.1-r1 Β· Apache-2.0
- nixpkgs unstable: bcc 0.37.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms