1funclatency(8)              System Manager's Manual             funclatency(8)
2
3
4

NAME

6       funclatency - Time functions and print latency as a histogram.
7

SYNOPSIS

9       funclatency  [-h]  [-p  PID] [-i INTERVAL] [-d DURATION] [-T] [-u] [-m]
10       [-F] [-r] [-v] pattern
11

DESCRIPTION

13       This tool traces function calls and times their duration (latency), and
14       shows  the  latency  distribution  as a histogram. The time is measured
15       from when the function is called to when it returns, and  is  inclusive
16       of both on-CPU time and time spent blocked.
17
18       This  tool uses in-kernel eBPF maps for storing timestamps and the his‐
19       togram, for efficiency.
20
21       Currently nested or recursive functions are not supported properly, and
22       timestamps  will  be overwritten, creating dubious output. Try to match
23       single functions, or groups of functions that run  at  the  same  stack
24       layer, and don't ultimately call each other.
25
26       WARNING:  This uses dynamic tracing of (what can be many) functions, an
27       activity that has had issues on some kernel versions (risk of panics or
28       freezes). Test, and know what you are doing, before use.
29
30       Since this uses BPF, only the root user can use this tool.
31

REQUIREMENTS

33       CONFIG_BPF and bcc.
34

OPTIONS

36       pattern  Function  name  or search pattern. Supports "*" wildcards. See
37       EXAMPLES.  You can also use -r for regular expressions.  -h Print usage
38       message.
39
40       -p PID Trace this process ID only.
41
42       -i INTERVAL
43              Print output every interval seconds.
44
45       -d DURATION
46              Total duration of trace, in seconds.
47
48       -T     Include timestamps on output.
49
50       -u     Output histogram in microseconds.
51
52       -m     Output histogram in milliseconds.
53
54       -F     Print a separate histogram per function matched.
55
56       -r     Use regular expressions for the search pattern.
57
58       -v     Print the BPF program (for debugging purposes).
59

EXAMPLES

61       Time the do_sys_open() kernel function, and print the distribution as a
62       histogram:
63              # funclatency do_sys_open
64
65       Time the read() function in libc across all processes on the system:
66              # funclatency c:read
67
68       Time vfs_read(), and print the histogram in units of microseconds:
69              # funclatency -u vfs_read
70
71       Time do_nanosleep(), and print the histogram in units of milliseconds:
72              # funclatency -m do_nanosleep
73
74       Time libc open(), and print output every 2  seconds,  for  duration  10
75       seconds:
76              # funclatency -i 2 -d 10 c:read
77
78       Time vfs_read(), and print output every 5 seconds, with timestamps:
79              # funclatency -mTi 5 vfs_read
80
81       Time vfs_read() for process ID 181 only:
82              # funclatency -p 181 vfs_read:
83
84       Time both vfs_fstat() and vfs_fstatat() calls, by use of a wildcard:
85              # funclatency 'vfs_fstat*'
86
87       Time both vfs_fstat* calls, and print a separate histogram for each:
88              # funclatency -F 'vfs_fstat*'
89

FIELDS

91       necs   Nanosecond range
92
93       usecs  Microsecond range
94
95       msecs  Millisecond range
96
97       count  How many calls fell into this range
98
99       distribution
100              An ASCII bar chart to visualize the distribution (count column)
101

OVERHEAD

103       This  traces  kernel functions and maintains in-kernel timestamps and a
104       histogram, which are asynchronously copied to  user-space.  While  this
105       method is very efficient, the rate of kernel functions can also be very
106       high (>1M/sec), at which point the overhead is expected to  be  measur‐
107       able.  Measure  in  a  test environment and understand overheads before
108       use. You can also use funccount to measure the rate of kernel functions
109       over a short duration, to set some expectations before use.
110

SOURCE

112       This is from bcc.
113
114              https://github.com/iovisor/bcc
115
116       Also  look  in  the bcc distribution for a companion _examples.txt file
117       containing example usage, output, and commentary for this tool.
118

OS

120       Linux
121

STABILITY

123       Unstable - in development.
124

AUTHOR

126       Brendan Gregg, Sasha Goldshtein
127

SEE ALSO

129       funccount(8)
130
131
132
133USER COMMANDS                     2015-08-18                    funclatency(8)
Impressum