/Documentation/basic_profiling.txt

https://bitbucket.org/evzijst/gittest · Plain Text · 52 lines · 38 code · 14 blank · 0 comment · 0 complexity · 78a7bdc7accce3a9096a8a7b100834d5 MD5 · raw file

  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. <test> is the thing you're trying to measure.
  6. Make sure you have the correct System.map / vmlinux referenced!
  7. It is probably easiest to use "make install" for linux and hack
  8. /sbin/installkernel to copy vmlinux to /boot, in addition to vmlinuz,
  9. config, System.map, which are usually installed by default.
  10. Readprofile
  11. -----------
  12. A recent readprofile command is needed for 2.6, such as found in util-linux
  13. 2.12a, which can be downloaded from:
  14. http://www.kernel.org/pub/linux/utils/util-linux/
  15. Most distributions will ship it already.
  16. Add "profile=2" to the kernel command line.
  17. clear readprofile -r
  18. <test>
  19. dump output readprofile -m /boot/System.map > captured_profile
  20. Oprofile
  21. --------
  22. Get the source (I use 0.8) from http://oprofile.sourceforge.net/
  23. and add "idle=poll" to the kernel command line
  24. Configure with CONFIG_PROFILING=y and CONFIG_OPROFILE=y & reboot on new kernel
  25. ./configure --with-kernel-support
  26. make install
  27. For superior results, be sure to enable the local APIC. If opreport sees
  28. a 0Hz CPU, APIC was not on. Be aware that idle=poll may mean a performance
  29. penalty.
  30. One time setup:
  31. opcontrol --setup --vmlinux=/boot/vmlinux
  32. clear opcontrol --reset
  33. start opcontrol --start
  34. <test>
  35. stop opcontrol --stop
  36. dump output opreport > output_file
  37. To only report on the kernel, run opreport /boot/vmlinux > output_file
  38. A reset is needed to clear old statistics, which survive a reboot.