sewardj | bf714ee | 2008-10-25 16:30:38 +0000 | [diff] [blame] | 1 | |
| 2 | # Note that you must do all the following as root (I believe). |
| 3 | # Although the program to be profiled can be run by anybody. |
| 4 | |
| 5 | # start the profiler |
| 6 | opcontrol --stop ; opcontrol --reset ; opcontrol --callgraph=5 --start |
| 7 | |
| 8 | # now run the program(s) to be profiled |
| 9 | |
| 10 | # stop the profiler and dump results to .. um .. some file somewhere |
| 11 | opcontrol --stop ; opcontrol --dump |
| 12 | |
| 13 | # produce a flat profile |
| 14 | opreport --merge=tgid --symbols -x \ |
| 15 | /home/sewardj/VgTRUNK/hgdev/Inst/lib/valgrind/x86-linux/helgrind \ |
| 16 | | less |
| 17 | |
| 18 | # produce a profile w/ callgraph |
| 19 | opreport --merge=tgid --callgraph \ |
| 20 | /home/sewardj/VgTRUNK/hgdev/Inst/lib/valgrind/x86-linux/helgrind \ |
| 21 | | less |
| 22 | |
| 23 | #### notes. |
| 24 | |
| 25 | 1. on amd64, need to build V with -fno-omit-frame-pointer, else the |
| 26 | w/ callgraph profiles are useless. (oprofile doesn't do CFI based |
| 27 | stack unwinding, I guess). Add -fno-omit-frame-pointer to |
| 28 | AM_CFLAGS_BASE in Makefile.flags.am, and rebuild from clean. |
| 29 | |
| 30 | 2. even at the best of times the callgraph profiles seem pretty |
| 31 | flaky to me. |
| 32 | |
| 33 | 3. Even oprofile 0.9.4 (the latest) on amd64-linux doesn't work |
| 34 | for callgraph profiling. There is however a patch that |
| 35 | makes it work. See |
| 36 | |
| 37 | http://sourceforge.net/tracker/index.php?func=detail&aid=1685267&group_id=16191&atid=116191 |
| 38 | |
| 39 | for details. Even then it sometimes fails at the "opcontrol |
| 40 | --dump" phase, complaining that the daemon died (or something like |
| 41 | that). But apart from that, it seems usable. |