Converting samples files
In all given examples, /var/lib/oprofile/samples/current is the samples
files session you want to act on. Backup your sample file dir before
proceeding
Converting sample file v8 to v9 (oprofile 0.6.1 to 0.7)
load and compile v8_v9.c
cd /var/lib/oprofile/samples/current
for f in `find -name "*" -type f`; do v8_v9 $f temp && mv temp $f; done
Converting sample file v9 to v10 (oprofile 0.7.1 to 0.8)
load and compile v9_v10.c
cd /var/lib/oprofile/samples/current
for f in `find -name "*" -type f`; do v9_v10 $f temp && mv temp $f; done
Converting sample file v10 to v11 (oprofile 0.9.2 to 0.9.3)
load and compile v10_v11.c
cd /var/lib/oprofile/samples/current
for f in `find -name "*" -type f`; do v10_v11 $f temp && mv temp $f; done
Things are bit tricky since the file format has been changed after 0.9.3
released. This mean if you already used 0.9.3 you have samples files with
the new file format but stamped with the old format version number. In
any case you need to edit oprofile_scr_dir/libop/op_config.h, change:
-#define OPD_VERSION 0x10
+#define OPD_VERSION 0x11
recompile and install oprofile.
If you have 0.9.3 profile session and want to continue to use them, bump
the file version bump_v10_v11.c
for f in `find -name "*" -type f`; do bump_v10_v11 $f temp && mv temp $f; done
Take care to apply this progs to the right samples dir, backup them first,
test the change, v10_v11.c does some sanity checking before modifying the
samples dir but some corner case are not checked, and bump_v10_v11.c
blindly bump the file version with only little check.
Oprofile callgraph patch against 2.6.0/2.6.1
This patch provide call graph sampling for OProfile on x86 arch. There is some restriction on the use.
- profiled application must not be compiled with -fomit-frame-pointer, So if you want kernel callgraph you need CONFIG_FRAME_POINTER.
- Since we access user space stack under NMI context we can't sleep, this
means we can lost some trace if an user space stack page is swapped to
disk or if current->mm->page_table_lock is already locked.
Load the callgraph patch
apply it to your kernel compile/install/reboot. This patch apply with some
fuzz to 2.6.0/2.6.1
You need also to apply this patch
(already present in 2.6.2-mm? series)
upload from sourceforge the current cvs
$ export CVSROOT=:pserver:anonymous@cvs.oprofile.sourceforge.net:/cvsroot/oprofile
$ cvs login
$ cvs co oprofile
Before profiling you must set the backtrace depth:
$ opcontrol --callgraph=32 --separate=library --init
Then start the profiler normally
Here 32 is the maximum stack depth walking allowed, you can choose it as
you want but be aware this is an experimental patch and the stack walking
is done under NMI context.
If you switch from/to 0.7.1 and the call graph version (0.8cvs) you must
$ opcontrol --reset
before restarting oprofile since call graph and the current oprofile
version doesn't use the same sample file format.
Post profiling tools:
You can use either opgprof or opstack, opstack is not yet full featured
but can handle callgraph to shared library while opgprof can't.
All you need now:
$ opgprof /your/binary
$ gprof /your/binary
or
$ opstack /your/binary
Philippe Elie
Last modified: Wed Nov 7 14:19:22 CET 2007