1

It's possible to create a bitmap or a vector image out of the data collected by the perf profiler under linux ?

  • Could you elaborate on what part of the output of perf would you like to plot? It should be doable to parse it and pipe into gnuplot or other plotting utility. – mkc Mar 2 '14 at 6:32
  • @Ketan I'm interested in multithreading and profiling the applications that work that way, so I would like to show, Cache misses, Percentage of branching, Memory usage, and so on. Mostly something about the CPU and a little bit about memory. But I would like to see some tutorial about that "piping", maybe I could adapt that to my needs. – user2485710 Mar 2 '14 at 15:48
  • Can you add the actual perf command(s) you're attempting to use. It's a pretty versatile tool and there are many directions to go here. – slm Mar 2 '14 at 16:35
  • @user2485710 There are many nice commandlines demonstrating piping and gnuplot on commandlinefu.com, one example is: history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head > /tmp/cmds | gnuplot -persist <(echo 'plot "/tmp/cmds" using 1:xticlabels(2) with boxes') which will plot the most frequently used commands from history. – mkc Mar 2 '14 at 17:08
2

Take a look at this article titled: perf Examples, it has a number of examples that show how you can make flame graphs such as this one:

    flamegraph

The above graph can be generated as an interactive SVG file as well. The graph was generated using the FlameGraph tool. This is separate software from perf.

A series of commands similar to this were used to generate that graph:

$ perf record -a -g -F 99 sleep 60
$ perf script | ./stackcollapse-perf.pl > out.perf-folded
$ ./flamegraph.pl out.perf-folded > perf-kernel.svg

The CPU FlameGraphs (above) are covered in more detail in this article, titled: CPU Flame Graphs. For details on FlameGraphs for other resources such as memory check out this page titled: Flame Graphs.

  • it really looks like an ugly graph, it works, but it's less readable than what I would like it to be – user2485710 Mar 2 '14 at 15:46
  • I would prefer a simple histogram or a simple chart with 2 dimensions ( 1 on x and 1 on y ) to this; the important thing is that it should be easy to read and less chaotic . – user2485710 Mar 2 '14 at 15:56
  • @user2485710 - I'm not finding a lot of tools that you can graph the perf data with. The FlameGraphs is by far the most feature rich and capable. The only other thing I found was perf report --gtk perf.data but that is pretty weak in comparison. – slm Mar 2 '14 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.