| .TH funcinterval 8 "2020-05-27" "USER COMMANDS" |
| .SH NAME |
| funcinterval \- Time interval between the same function, tracepoint as a histogram. |
| .SH SYNOPSIS |
| .B funcinterval [\-h] [\-p PID] [\-i INTERVAL] [\-d DURATION] [\-T] [\-u] [\-m] [\-v] pattern |
| .SH DESCRIPTION |
| This tool times interval between the same function as a histogram. |
| |
| eBPF/bcc is very suitable for platform performance tuning. |
| By funclatency, we can profile specific functions to know how latency |
| this function costs. However, sometimes performance drop is not about the |
| latency of function but the interval between function calls. |
| funcinterval is born for this purpose. |
| |
| This tool uses in-kernel eBPF maps for storing timestamps and the histogram, |
| for efficiency. |
| |
| 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. |
| .SH REQUIREMENTS |
| CONFIG_BPF and bcc. |
| .SH OPTIONS |
| pattern |
| Function name. |
| \-h |
| Print usage message. |
| .TP |
| \-p PID |
| Trace this process ID only. |
| .TP |
| \-i INTERVAL |
| Print output every interval seconds. |
| .TP |
| \-d DURATION |
| Total duration of trace, in seconds. |
| .TP |
| \-T |
| Include timestamps on output. |
| .TP |
| \-u |
| Output histogram in microseconds. |
| .TP |
| \-m |
| Output histogram in milliseconds. |
| .TP |
| \-v |
| Print the BPF program (for debugging purposes). |
| .SH EXAMPLES |
| .TP |
| Time the interval of do_sys_open() kernel function as a histogram: |
| # |
| .B funcinterval do_sys_open |
| .TP |
| Time the interval of xhci_ring_ep_doorbell(), in microseconds: |
| # |
| .B funcinterval -u xhci_ring_ep_doorbell |
| .TP |
| Time the interval of do_nanosleep(), in milliseconds |
| # |
| .B funcinterval -m do_nanosleep |
| .TP |
| Output every 5 seconds, with timestamps: |
| # |
| .B funcinterval -mTi 5 vfs_read |
| .TP |
| Time process 181 only: |
| # |
| .B funcinterval -p 181 vfs_read |
| .TP |
| Time the interval of mm_vmscan_direct_reclaim_begin tracepoint: |
| # |
| .B funcinterval t:vmscan:mm_vmscan_direct_reclaim_begin |
| .TP |
| Time the interval of c:malloc used by top every 3 seconds: |
| # |
| .B funcinterval -p `pidof -s top` -i 3 c:malloc |
| .TP |
| Time /usr/local/bin/python main function: |
| # |
| .B funcinterval /usr/local/bin/python:main |
| .SH FIELDS |
| .TP |
| necs |
| Nanosecond range |
| .TP |
| usecs |
| Microsecond range |
| .TP |
| msecs |
| Millisecond range |
| .TP |
| count |
| How many calls fell into this range |
| .TP |
| distribution |
| An ASCII bar chart to visualize the distribution (count column) |
| .SH 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. |
| .SH SOURCE |
| This is from bcc. |
| .IP |
| https://github.com/iovisor/bcc |
| .PP |
| Also look in the bcc distribution for a companion _examples.txt file containing |
| example usage, output, and commentary for this tool. |
| .SH OS |
| Linux |
| .SH STABILITY |
| Unstable - in development. |
| .SH AUTHOR |
| Edward Wu |
| .SH SEE ALSO |
| funclatency(8) |
| funccount(8) |