Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to get the most useful output from oprofile?

Using tools such as:

  • opreport
  • opcontrol
  • opannotate

I am starting to use this tool and trying to find the best combinations, examples to get the most out of profiling.

Thanks

like image 334
vehomzzz Avatar asked Sep 03 '09 12:09

vehomzzz


2 Answers

gprof2dot is the most amazing visualization tool for profile data.

opcontrol --shutdown
opcontrol --callgraph=7
opcontrol --image=<abs/path/to/your/execuable>
opcontrol --start

... time passes ...

opcontrol --dump
opreport -c > profile_info.txt
gprof2dot.py -f oprofile --strip profile_info.txt | dot -Tsvg > profile_graph.svg
inkscape profile_graph.svg

gprof2dot's --skew option is really nice when drilling down the actual problem code.

Remeber you can't set callgraph if you've manually set the event counter to a low number. Be default the when using the --callgraph option the minimum counter is 15 times larger than the one listed in --list-events


Edit: example screenshot: gprof2dot.py example output

The resolution is reduced to avoid disclosing confidential data, but you get the idea.

like image 62
deft_code Avatar answered Oct 31 '22 06:10

deft_code


Look at the KCachegrind - it's a profile data visualization tool.

KCachegrind visualize data files generated by Callgrind profiler tool. But with conversion scripts, KCachegrind is able to visualize output of other profilers like OProfile.

When you install KCachegrind using a package manager (yum, apt-get, etc.) you get a tool called op2calltree which transforms Oprofile's output to KCachegrind's format.

like image 5
zxcat Avatar answered Oct 31 '22 04:10

zxcat