Graphical Profiling / Call Graph analysis

Graphical Profiling / Call Graph analysis

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
Acidd_UK
Posts: 963
Joined: 23 Apr 2006, 02:15

Graphical Profiling / Call Graph analysis

Post by Acidd_UK »

I remember a post from one of the Devs a while ago showing off some wizzy graphical tool that analysed call graph and profiling date, and produced a tree-like diagram showing the function/method hierarchy and the time spent in those functions.

Can anyone remember the tool(s) used, or can anyone find the post I'm talking about? I've searched various topics but I can't find the thing :-(
User avatar
Acidd_UK
Posts: 963
Joined: 23 Apr 2006, 02:15

Re: Graphical Profiling / Call Graph analysis

Post by Acidd_UK »

Thanks, now I just need to find out how the graph was generated!
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Re: Graphical Profiling / Call Graph analysis

Post by BrainDamage »

I used oprofile ( linux only ) for the data acquisition:
http://oprofile.sourceforge.net/about/

Code: Select all

# opcontrol -c=16 -p=library,thread,cpu --no-vmlinux
# opcontrol --start
$ spring ( must contain debug symbols )
# opcontrol --stop
# opcontrol --flush
$ opreport -cgf --demangle=smart --exclude-dependent --merge=tgid,cpu,tid --symbols /path/to/spring > calldata.txt
oprof is a statistical profiler, you might want to calculate number of samples to have error confidence less than your acceptable level

gprof2dot to convert the table data into a graph script
http://code.google.com/p/jrfonseca/wiki/Gprof2Dot

Code: Select all

$ gprof2dot -f oprofile -o dotgraph.dot calldata.txt
gprof2dot can convert from multiple profiling tools, but I found oprofile to be best since it only requires debug symbols in the binary to work, and the slowdown it introduces is neglectable
either you're running linux, windows, or mac you could try gprof, altho it requires for the binary to be compiled using special gprof symbols, slows down the app to grind levels, and I find it somehow crappier than oprof. ( after compiling the app with the special symbols, you'll have to run it and parse the binary profile data with the gprof tool in order to make it readble from the script, make sure you'll enable call graph output from gprof )

graphviz to render the graph script http://www.graphviz.org/
$ dot -T svg -o svggraph.svg dotgraph.dot
User avatar
Acidd_UK
Posts: 963
Joined: 23 Apr 2006, 02:15

Re: Graphical Profiling / Call Graph analysis

Post by Acidd_UK »

That's fantastic - we've actually used oprofile already but I didn't know about gprof2dot - thanks!
Post Reply

Return to “Engine”