I use linux perf (perf_events) to produce a perf.data file with timestamps.
How can I generate a report of all the events in a sub interval of time [i-start, i-end]?
Can I maybe narrow down perf.data to a perf_subinterv.data file with only events in [i-start, i-end]?
I need to do this to analyze short intervals (2s - 6s) of poor performance every 5mins or so.
Most
perf
tools, includingperf report
, support filtering by time:For more details see
man perf-report
.This is present since version 4.10 (Feb 2017). If you run an older kernel you can try to build the userspace tools part of
perf
yourself. In more recent versions it is possible to specify time percent and multiple time ranges.I still cannot produce a perf_subinterv.data, but I can narrow down the perf trace in textual representation. Then, for further analysis, I can for instance generate a flame graph.
Command to narrow to time interval at 19:29:43 with 3.47s duration:
Generation of flame graph:
gawk script: