Profiling

Yang Zhang <[email protected]> Thu, 15 Jan 2009 02:40:24 -0500
Newsgroups gmane.comp.lib.state-threads.user
Message-ID <[email protected]>
Does anybody have experience profiling ST programs?  Any advice on how
to do this?

I'm currently trying to profile this simple C++ app:

http://assorted.svn.sourceforge.net/viewvc/assorted/ydb/trunk/src/main.lzz.clamp?revision=1130&view=markup

(Higher-level info about this program can be found at
http://assorted.sf.net/ydb/.)

With gprof, I obtain strange results.  They don't appear to be garbage,
but otherwise I'm not sure whether (or how) to trust the results:

- Many things are shown as taking up 100% of the time.  How exactly does
gprof work (with ST)?  Does gprof somehow understand the different ST
threads as different threads, and thus be able to give a full 100% to
each thread?  Because if not, I'd expect each thread to take up <100%
(but add up to 100%).  Does this even happen with OS threads?

- Certain connections aren't being made, such as the one between
swallow and issue_txns.

See some [gprof output] from a run of this program (running as a 
leader), along with [the visualization] produced using [gprof2dot]. 
(BTW, [xdot] is a good dot viewer.)

[gprof output]: http://www.mit.edu/~y_z/st-prof/gprof.bz2
[the visualization]: http://www.mit.edu/~y_z/st-prof/dot.pdf
[gprof2dot]: http://code.google.com/p/jrfonseca/wiki/Gprof2Dot
[xdot]: http://code.google.com/p/jrfonseca/wiki/XDot

Aside: has anybody tried using google-perftools with ST?
-- 
Yang Zhang
http://www.mit.edu/~y_z/

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword