valgrind-monitor.py regular expressions should use raw strings
[valgrind.git] / docs / internals / howto_oprofile.txt
blob863bb60469eb80a95436df8b74a44840d3fb53c2
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.
5 # start the profiler
6 opcontrol --stop ; opcontrol --reset ; opcontrol --callgraph=5 --start
8 # now run the program(s) to be profiled
10 # stop the profiler and dump results to .. um .. some file somewhere
11 opcontrol --stop ; opcontrol --dump
13 # get total cost
14 opreport --merge=tgid -x \
15     /home/sewardj/VgTRUNK/atomk/Inst/lib/valgrind/helgrind-amd64-linux \
16     | less
18 # produce a flat profile
19 opreport --merge=tgid --symbols -x \
20     /home/sewardj/VgTRUNK/atomk/Inst/lib/valgrind/helgrind-amd64-linux \
21     | less
23 # produce a profile w/ callgraph
24 opreport --merge=tgid --callgraph -x \
25     /home/sewardj/VgTRUNK/atomk/Inst/lib/valgrind/helgrind-amd64-linux \
26     | less
28 # print annotated source
29 opannotate --merge=tgid --source --include-file=libhb_core.c | less
32 #### notes.
34 1. on amd64, need to build V with -fno-omit-frame-pointer, else the
35    w/ callgraph profiles are useless.  (oprofile doesn't do CFI based
36    stack unwinding, I guess).  Add -fno-omit-frame-pointer to
37    AM_CFLAGS_BASE in Makefile.flags.am, and rebuild from clean.
39 2. even at the best of times the callgraph profiles seem pretty
40    flaky to me.
42 3. Even oprofile 0.9.4 (the latest) on amd64-linux doesn't work
43    for callgraph profiling.  There is however a patch that
44    makes it work.  See 
46 http://sourceforge.net/tracker/index.php?func=detail&aid=1685267&group_id=16191&atid=116191
48    for details.  Even then it sometimes fails at the "opcontrol
49    --dump" phase, complaining that the daemon died (or something like
50    that).  But apart from that, it seems usable.