Sample Header Ad - 728x90

How to take stack samples using `perf` based on wall-clock time

1 vote
0 answers
563 views
I am trying to use Linux's perf_events framework to investigate an issue with an application on one of our servers. Based on my reading about the perf tool, collecting stacks is relatively straightforward. I want to know if it's possible to simply use the wall-time as a kind of event to collect stacks every N seconds. The current command I've been using is:
perf record -e cycles -T -o /samples.data -F 1 --call-graph dwarf -T -p
From my current understanding, this command will sample every 1 second (-F 1) and grab the stacks (-g) from the process (-p ) until the perf command is terminated with a signal. But based on the data I collect, it seems like there is more than one set of samples per second? So, I think I am misinterpreting or misunderstanding something about the way perf collects samples. Also, what if I wanted to record stacks every 2, 5, or 10 seconds to reduce the amount of data collected? Is there a way to achieve that with perf?
Asked by zac (111 rep)
Jun 24, 2020, 09:49 PM