basic_profiling.txt 1.72 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
These instructions are deliberately very basic. If you want something clever,
go read the real docs ;-) Please don't add more stuff, but feel free to 
correct my mistakes ;-)    (mbligh@aracnet.com)
Thanks to John Levon, Dave Hansen, et al. for help writing this.

<test> is the thing you're trying to measure.
Make sure you have the correct System.map / vmlinux referenced!
IMHO it's easier to use "make install" for linux and hack /sbin/installkernel
to copy config files, system.map, vmlinux to /boot.

Readprofile
-----------
You need a fixed readprofile command for 2.5 ... either get hold of
a current version from:
http://www.kernel.org/pub/linux/utils/util-linux/
or get readprofile binary fixed for 2.5 / akpm's 2.5 patch from 
ftp://ftp.kernel.org/pub/linux/kernel/people/mbligh/tools/readprofile/

Add "profile=2" to the kernel command line.

clear		readprofile -r
		<test>
dump output	readprofile -m /boot/System.map > captured_profile

Oprofile
--------
get source (I use 0.5) from http://oprofile.sourceforge.net/
add "idle=poll" to the kernel command line 
Configure with CONFIG_PROFILING=y and CONFIG_OPROFILE=y & reboot on new kernel
./configure --with-kernel-support
make install

One time setup (pick appropriate one for your CPU):
P3		opcontrol --setup --vmlinux=/boot/vmlinux \
		--ctr0-event=CPU_CLK_UNHALTED --ctr0-count=100000
Athlon/x86-64	opcontrol --setup --vmlinux=/boot/vmlinux \
		--ctr0-event=RETIRED_INSNS --ctr0-count=100000
P4		opcontrol --setup --vmlinux=/boot/vmlinux \
		--ctr0-event=GLOBAL_POWER_EVENTS \
		--ctr0-unit-mask=1 --ctr0-count=100000

start daemon	opcontrol --start-daemon
clear		opcontrol --reset
start		opcontrol --start
		<test>
stop		opcontrol --stop
dump output	oprofpp -dl -i /boot/vmlinux  >  output_file