This uses in-kernel eBPF maps to cache process details (PID and comm) by I/O
request, as well as a starting timestamp for calculating I/O latency.
+This works by tracing various kernel blk_*() functions using dynamic tracing,
+and will need updating to match any changes to these functions.
+
This makes use of a Linux 4.5 feature (bpf_perf_event_output());
for kernels older than 4.5, see the version under tools/old,
which uses an older mechanism
start_ts = 0
prev_ts = 0
delta = 0
+
# process event
def print_event(cpu, data, size):
event = ct.cast(data, ct.POINTER(Data)).contents
prev_ts = event.ts
start_ts = 1
+# loop with callback to print_event
b["events"].open_perf_buffer(print_event)
while 1:
b.kprobe_poll()