|
From: <sv...@va...> - 2008-10-15 16:35:18
|
Author: sewardj Date: 2008-10-15 17:30:55 +0100 (Wed, 15 Oct 2008) New Revision: 8673 Log: OProfile is a really useful tool for profiling Valgrind, but it is a fragile PITA and often doesn't work for completely non-obvious reasons. This file contains some hints on how to get a working OProfile setup. Added: branches/YARD/docs/internals/howto_oprofile.txt Modified: branches/YARD/docs/internals/Makefile.am Modified: branches/YARD/docs/internals/Makefile.am =================================================================== --- branches/YARD/docs/internals/Makefile.am 2008-10-15 12:19:07 UTC (rev 8672) +++ branches/YARD/docs/internals/Makefile.am 2008-10-15 16:30:55 UTC (rev 8673) @@ -3,6 +3,7 @@ 3_2_BUGSTATUS.txt 3_3_BUGSTATUS.txt \ darwin-notes.txt darwin-syscalls.txt \ directory-structure.txt \ + howto_oprofile.txt \ m_replacemalloc.txt \ m_syswrap.txt module-structure.txt notes.txt porting-HOWTO.txt \ mpi2entries.txt \ Added: branches/YARD/docs/internals/howto_oprofile.txt =================================================================== --- branches/YARD/docs/internals/howto_oprofile.txt (rev 0) +++ branches/YARD/docs/internals/howto_oprofile.txt 2008-10-15 16:30:55 UTC (rev 8673) @@ -0,0 +1,41 @@ + +# Note that you must do all the following as root (I believe). +# Although the program to be profiled can be run by anybody. + +# start the profiler +opcontrol --stop ; opcontrol --reset ; opcontrol --callgraph=5 --start + +# now run the program(s) to be profiled + +# stop the profiler and dump results to .. um .. some file somewhere +opcontrol --stop ; opcontrol --dump + +# produce a flat profile +opreport --merge=tgid --symbols -x \ + /home/sewardj/VgTRUNK/hgdev/Inst/lib/valgrind/x86-linux/helgrind \ + | less + +# produce a profile w/ callgraph +opreport --merge=tgid --callgraph \ + /home/sewardj/VgTRUNK/hgdev/Inst/lib/valgrind/x86-linux/helgrind \ + | less + +#### notes. + +1. on amd64, need to build V with -fno-omit-frame-pointer, else the + w/ callgraph profiles are useless. (oprofile doesn't do CFI based + stack unwinding, I guess). Add -fno-omit-frame-pointer to + AM_CFLAGS_BASE in Makefile.flags.am, and rebuild from clean. + +2. even at the best of times the callgraph profiles seem pretty + flaky to me. + +3. Even oprofile 0.9.4 (the latest) on amd64-linux doesn't work + for callgraph profiling. There is however a patch that + makes it work. See + +http://sourceforge.net/tracker/index.php?func=detail&aid=1685267&group_id=16191&atid=116191 + + for details. Even then it sometimes fails at the "opcontrol + --dump" phase, complaining that the daemon died (or something like + that). But apart from that, it seems usable. |