| # vfsreadlat.py VFS read latency distribution. |
| # For Linux, uses BCC, eBPF. See .c file. |
| # Written as a basic example of a function latency distribution histogram. |
| # USAGE: vfsreadlat.py [interval [count]] |
| # The default interval is 5 seconds. A Ctrl-C will print the partially |
| # gathered histogram then exit. |
| # Copyright (c) 2015 Brendan Gregg. |
| # Licensed under the Apache License, Version 2.0 (the "License") |
| # 15-Aug-2015 Brendan Gregg Created this. |
| from __future__ import print_function |
| print("USAGE: %s [interval [count]]" % argv[0]) |
| except: # also catches -h, --help |
| b = BPF(src_file = "vfsreadlat.c") |
| b.attach_kprobe(event="vfs_read", fn_name="do_entry") |
| b.attach_kretprobe(event="vfs_read", fn_name="do_return") |
| print("Tracing... Hit Ctrl-C to end.") |
| except KeyboardInterrupt: |
| b["dist"].print_log2_hist("usecs") |