linux perf: limiting to just some small periods of time
1
vote
0
answers
325
views
I'm writing a video game, and have used
perf(1)
and flame graphs to get some decent "whole program performance" information.
However, I also want to investigate specific worst-case periods, such as certain frames that take too long. Is there a good way to do this kind of measurement with perf?
Equivalently, you could imagine this in a web server context, where you want to investigate specific slow responses that were sent, not just overall throughput.
I had the following notion, but I'm wondering if I can do better: dump out the full list of events with perf record
and perf script
, and also dump out start/end timestamps from my game for slow frames. Then, use some script to correlate the timestamps and only look at the perf events relevant to that time period. Seems workable, but a little brittle based on timestamps.
Maybe there is some way to add calls inside my code that say "start recording perf events now", and "stop recording them now", like creating a perf.dat
file per-frame ?
Or maybe I can output some special events like "frame begin, frame end", which would get included in the full event log that is dumped from my program run? This way everything is in the perf.dat file, and I don't have to correlate across two different output files.
Or any other ideas?
Asked by jwd
(1509 rep)
Apr 8, 2021, 08:49 PM