linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Reordering the thread output in perf trace --summary
@ 2016-05-04  9:02 Milian Wolff
  2016-05-04  9:51 ` Milian Wolff
  0 siblings, 1 reply; 8+ messages in thread
From: Milian Wolff @ 2016-05-04  9:02 UTC (permalink / raw)
  To: linux-perf-users@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 2409 bytes --]

Hey all,

when using `perf trace --summary` on a (badly designed) user application that 
creates tons of threads, the usually interesting overall summary is drowned by 
the per-thread summary output. I.e.:

perf trace --summary lab_mandelbrot_concurrent |& grep events
 lab_mandelbrot_ (19497), 9246 events, 25.7%, 0.000 msec
 QXcbEventReader (19498), 1094 events, 3.0%, 0.000 msec
 QDBusConnection (19499), 132 events, 0.4%, 0.000 msec
 Thread (pooled) (19500), 1982 events, 5.5%, 0.000 msec
 Thread (pooled) (19501), 114 events, 0.3%, 0.000 msec
 lab_mandelbrot_ (19502), 88 events, 0.2%, 0.000 msec
 Thread (pooled) (19503), 106 events, 0.3%, 0.000 msec
 Thread (pooled) (19504), 101 events, 0.3%, 0.000 msec
 Thread (pooled) (19505), 102 events, 0.3%, 0.000 msec
... continued for a total of 163 lines

usually, I forget to pipe the output of `perf trace --summary` into a file and 
then have to rerun the command, as the total output (2643 lines!) easily 
exceeds my scrollback buffer.

I would like to propose to reorder the output to sort the output in ascending 
total event order, such that the most interesting output is shown at the 
bottom of the output on the CLI. I.e. in the output above it should be 
something like

perf trace --summary lab_mandelbrot_concurrent |& grep events
... continued for a total of 163 lines
 lab_mandelbrot_ (19502), 88 events, 0.2%, 0.000 msec
 Thread (pooled) (19501), 114 events, 0.3%, 0.000 msec
 Thread (pooled) (19503), 106 events, 0.3%, 0.000 msec
 Thread (pooled) (19504), 101 events, 0.3%, 0.000 msec
 Thread (pooled) (19505), 102 events, 0.3%, 0.000 msec
 QDBusConnection (19499), 132 events, 0.4%, 0.000 msec
 QXcbEventReader (19498), 1094 events, 3.0%, 0.000 msec
 Thread (pooled) (19500), 1982 events, 5.5%, 0.000 msec
 lab_mandelbrot_ (19497), 9246 events, 25.7%, 0.000 msec

If this is acceptable to you, can someone please tell me how to do such a 
seemingly simple task in C? In C++ I'd except to add a simple std::sort 
somewhere, but in perf's C...? My current idea would be to run 
machine__for_each_thread and store the even count + thread pointer in another 
temporary buffer, which I then qsort and finally iterate over. Does that sound 
OK, or how would you approach this task?

Thanks
-- 
Milian Wolff | milian.wolff@kdab.com | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel: +49-30-521325470
KDAB - The Qt Experts

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5903 bytes --]

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

end of thread, other threads:[~2016-05-09 20:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-04  9:02 Reordering the thread output in perf trace --summary Milian Wolff
2016-05-04  9:51 ` Milian Wolff
2016-05-04 21:41   ` Arnaldo Carvalho de Melo
2016-05-05 16:04     ` [DONE] " Arnaldo Carvalho de Melo
2016-05-09  8:28       ` Milian Wolff
2016-05-09 16:25         ` Arnaldo Carvalho de Melo
2016-05-09 18:03           ` Milian Wolff
2016-05-09 20:12             ` Arnaldo Carvalho de Melo

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).