1funcinterval(8) System Manager's Manual funcinterval(8)
2
3
4
6 funcinterval - Time interval between the same function, tracepoint as a
7 histogram.
8
10 funcinterval [-h] [-p PID] [-i INTERVAL] [-d DURATION] [-T] [-u] [-m]
11 [-v] pattern
12
14 This tool times interval between the same function as a histogram.
15
16 eBPF/bcc is very suitable for platform performance tuning. By funcla‐
17 tency, we can profile specific functions to know how latency this func‐
18 tion costs. However, sometimes performance drop is not about the la‐
19 tency of function but the interval between function calls. funcinter‐
20 val is born for this purpose.
21
22 This tool uses in-kernel eBPF maps for storing timestamps and the his‐
23 togram, for efficiency.
24
25 WARNING: This uses dynamic tracing of (what can be many) functions, an
26 activity that has had issues on some kernel versions (risk of panics or
27 freezes). Test, and know what you are doing, before use.
28
29 Since this uses BPF, only the root user can use this tool.
30
32 CONFIG_BPF and bcc.
33
35 pattern Function name. -h Print usage message.
36
37 -p PID Trace this process ID only.
38
39 -i INTERVAL
40 Print output every interval seconds.
41
42 -d DURATION
43 Total duration of trace, in seconds.
44
45 -T Include timestamps on output.
46
47 -u Output histogram in microseconds.
48
49 -m Output histogram in milliseconds.
50
51 -v Print the BPF program (for debugging purposes).
52
54 Time the interval of do_sys_open() kernel function as a histogram:
55 # funcinterval do_sys_open
56
57 Time the interval of xhci_ring_ep_doorbell(), in microseconds:
58 # funcinterval -u xhci_ring_ep_doorbell
59
60 Time the interval of do_nanosleep(), in milliseconds
61 # funcinterval -m do_nanosleep
62
63 Output every 5 seconds, with timestamps:
64 # funcinterval -mTi 5 vfs_read
65
66 Time process 181 only:
67 # funcinterval -p 181 vfs_read
68
69 Time the interval of mm_vmscan_direct_reclaim_begin tracepoint:
70 # funcinterval t:vmscan:mm_vmscan_direct_reclaim_begin
71
72 Time the interval of c:malloc used by top every 3 seconds:
73 # funcinterval -p `pidof -s top` -i 3 c:malloc
74
75 Time /usr/local/bin/python main function:
76 # funcinterval /usr/local/bin/python:main
77
79 necs Nanosecond range
80
81 usecs Microsecond range
82
83 msecs Millisecond range
84
85 count How many calls fell into this range
86
87 distribution
88 An ASCII bar chart to visualize the distribution (count column)
89
91 This traces kernel functions and maintains in-kernel timestamps and a
92 histogram, which are asynchronously copied to user-space. While this
93 method is very efficient, the rate of kernel functions can also be very
94 high (>1M/sec), at which point the overhead is expected to be measur‐
95 able. Measure in a test environment and understand overheads before
96 use. You can also use funccount to measure the rate of kernel functions
97 over a short duration, to set some expectations before use.
98
100 This is from bcc.
101
102 https://github.com/iovisor/bcc
103
104 Also look in the bcc distribution for a companion _examples.txt file
105 containing example usage, output, and commentary for this tool.
106
108 Linux
109
111 Unstable - in development.
112
114 Edward Wu
115
117 funclatency(8) funccount(8)
118
119
120
121USER COMMANDS 2020-05-27 funcinterval(8)