This traces four kernel functions and prints per-processes summaries every interval seconds. This can be useful for processes workload characterization, and looking for patterns in operation usage over time. It provides a top-like interface which by default sorts by HITS in ascending order.
This works by tracing kernel page cache functions using dynamic tracing, and will need updating to match any changes to these functions. Edit the script to customize which functions are traced.
Since this uses BPF, only the root user can use this tool.
The following keybindings can be used to control the output of cachetop.
Use the previous column for sorting.
Use the next column for sorting.
Toggle sorting order (default ascending).
CONFIG_BPF and bcc.
- Update summaries every five second:
- Print summaries each second:
# cachetop 1
Process ID of the process causing the cache activity.
User ID of the process causing the cache activity.
Number of page cache hits.
Number of page cache misses.
Number of dirty pages added to the page cache.
Read hit percent of page cache usage.
Write hit percent of page cache usage.
Buffers size taken from /proc/meminfo.
Cached amount of data in current page cache taken from /proc/meminfo.
This traces various kernel page cache functions and maintains in-kernel counts, which are asynchronously copied to user-space. While the rate of operations can be very high (>1G/sec) we can have up to 34% overhead, this is still a relatively efficient way to trace these events, and so the overhead is expected to be small for normal workloads. Measure in a test environment.
This is from bcc.
Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool.
Unstable - in development.