linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* perf record per-thread vs per-cpu behavior
@ 2021-12-08 23:33 Josh Hunt
  2021-12-09 17:52 ` Jiri Olsa
  0 siblings, 1 reply; 2+ messages in thread
From: Josh Hunt @ 2021-12-08 23:33 UTC (permalink / raw)
  To: linux-perf-users

Hi

I'm seeing what I believe to be incorrect behavior when running perf 
record -p and was hoping I could get some clarification from someone 
here. We have an application which has around 800 threads and when I run 
perf record -p <pid> on that the # of samples returned seems impossible 
given the # of cpus, sampling freq, and duration of profile.

I'm running on a 5.4 LTS kernel and the machine has 40 hw threads.

Running with -p <pid> I see:
# perf record -p 7297 -s -F 49 --call-graph lbr -- sleep 5
[ perf record: Woken up 32 times to write data ]
[ perf record: Captured and wrote 11.798 MB perf.data (58430 samples) ]

and I've confirmed there are actually 58k samples in the data file, but 
the # of samples should be closer to 5 * 49 * 40 = 9800.

Running with -a I see something closer to what I would expect:

# perf record -a -s -F 49 --call-graph lbr -- sleep 5
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 3.405 MB perf.data (9745 samples) ]

Running with -p on applications with fewer threads seems to produce 
something closer to what I would expect since the pid being profiled 
isn't on cpu 100% of the time:

# perf record -p 11629 -s -F 49 --call-graph lbr -- sleep 5
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.279 MB perf.data (1324 samples) ]

It's very possible I'm doing something wrong or don't understand things 
:) but if anyone has any insights into the above I'd appreciate your help!

I should also say that the resulting reports look different and it has 
me questioning the validity of the -p data.

I'm happy to provide more info if needed, and thanks for any guidance 
you can provide.

Josh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-09 17:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-08 23:33 perf record per-thread vs per-cpu behavior Josh Hunt
2021-12-09 17:52 ` Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).