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