Path: blob/master/Documentation/basic_profiling.txt
10820 views
These instructions are deliberately very basic. If you want something clever,1go read the real docs ;-) Please don't add more stuff, but feel free to2correct my mistakes ;-) ([email protected])3Thanks to John Levon, Dave Hansen, et al. for help writing this.45<test> is the thing you're trying to measure.6Make sure you have the correct System.map / vmlinux referenced!78It is probably easiest to use "make install" for linux and hack9/sbin/installkernel to copy vmlinux to /boot, in addition to vmlinuz,10config, System.map, which are usually installed by default.1112Readprofile13-----------14A recent readprofile command is needed for 2.6, such as found in util-linux152.12a, which can be downloaded from:1617http://www.kernel.org/pub/linux/utils/util-linux/1819Most distributions will ship it already.2021Add "profile=2" to the kernel command line.2223clear readprofile -r24<test>25dump output readprofile -m /boot/System.map > captured_profile2627Oprofile28--------2930Get the source (see Changes for required version) from31http://oprofile.sourceforge.net/ and add "idle=poll" to the kernel command32line.3334Configure with CONFIG_PROFILING=y and CONFIG_OPROFILE=y & reboot on new kernel3536./configure --with-kernel-support37make install3839For superior results, be sure to enable the local APIC. If opreport sees40a 0Hz CPU, APIC was not on. Be aware that idle=poll may mean a performance41penalty.4243One time setup:44opcontrol --setup --vmlinux=/boot/vmlinux4546clear opcontrol --reset47start opcontrol --start48<test>49stop opcontrol --stop50dump output opreport > output_file5152To only report on the kernel, run opreport -l /boot/vmlinux > output_file5354A reset is needed to clear old statistics, which survive a reboot.55565758