ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / Documentation / basic_profiling.txt
1 These instructions are deliberately very basic. If you want something clever,
2 go read the real docs ;-) Please don't add more stuff, but feel free to 
3 correct my mistakes ;-)    (mbligh@aracnet.com)
4 Thanks to John Levon, Dave Hansen, et al. for help writing this.
5
6 <test> is the thing you're trying to measure.
7 Make sure you have the correct System.map / vmlinux referenced!
8 IMHO it's easier to use "make install" for linux and hack /sbin/installkernel
9 to copy config files, system.map, vmlinux to /boot.
10
11 Readprofile
12 -----------
13 You need a fixed readprofile command for 2.5 ... either get hold of
14 a current version from:
15 http://www.kernel.org/pub/linux/utils/util-linux/
16 or get readprofile binary fixed for 2.5 / akpm's 2.5 patch from 
17 ftp://ftp.kernel.org/pub/linux/kernel/people/mbligh/tools/readprofile/
18
19 Add "profile=2" to the kernel command line.
20
21 clear           readprofile -r
22                 <test>
23 dump output     readprofile -m /boot/System.map > captured_profile
24
25 Oprofile
26 --------
27 get source (I use 0.5) from http://oprofile.sourceforge.net/
28 add "idle=poll" to the kernel command line 
29 Configure with CONFIG_PROFILING=y and CONFIG_OPROFILE=y & reboot on new kernel
30 ./configure --with-kernel-support
31 make install
32
33 One time setup (pick appropriate one for your CPU):
34 P3              opcontrol --setup --vmlinux=/boot/vmlinux \
35                 --ctr0-event=CPU_CLK_UNHALTED --ctr0-count=100000
36 Athlon/x86-64   opcontrol --setup --vmlinux=/boot/vmlinux \
37                 --ctr0-event=RETIRED_INSNS --ctr0-count=100000
38 P4              opcontrol --setup --vmlinux=/boot/vmlinux \
39                 --ctr0-event=GLOBAL_POWER_EVENTS \
40                 --ctr0-unit-mask=1 --ctr0-count=100000
41
42 start daemon    opcontrol --start-daemon
43 clear           opcontrol --reset
44 start           opcontrol --start
45                 <test>
46 stop            opcontrol --stop
47 dump output     oprofpp -dl -i /boot/vmlinux  >  output_file
48