Analyzing Kernel Modules Data in OProfile in RHEL3 William Cohen wcohen@redhat.com 6/20/2005 OProfile collects data on a system-wide basis for kernel- and user-space code running on the machine. However, once a module is loaded into the kernel, the information about the origin of the kernel module is lost. The module could have come from the initrd file on boot up, the directory with the various kernel modules, or a locally created kernel module. As a result when OProfile records sample for a module, it just lists the samples for the modules for an executable in the root directory, but this is unlikley to the place with the actual code for the module. You will need to take some steps to make sure that analysis tools get the executable. For example on a i686 machine the sampling is set up to record "CPU_CLOCK_UNHALTED" and you would like to see the data for the ext3 module: opcontrol --setup --vmlinux=/boot/vmlinux-`uname -r` \ --ctr0-event=CPU_CLK_UNHALTED --ctr0-count=366000 \ --separate=library opcontrol --start Find the appropriate module by doing something like the the following (and replacing ext3 with the appropriate module name) $ op_time |grep ext3 23 0.4061 0.0000 /lib/ext3.o If the op_time did not list the file in the correct place, make a symbolic link so oprofile finds the code for the module in the location listed by op_time (for the case of ext3.o): # ln -s /lib/modules/`uname -r`/kernel/fs/ext3/ext3.o /lib/. Then the detailed information can be obtained with: # oprofpp -r -l /lib/ext3.o |more oprofpp: warning: could not check that the binary file /lib/ext3.o has not been modified since the profile was taken. Results may be inaccurate. Cpu type: PIII Cpu speed was (MHz estimation) : 731.48 Counter 0 counted CPU_CLK_UNHALTED events (clocks processor is not halted) with a unit mask of 0x00 (No unit mask) count 366000 vma samples % symbol name 000106d0 5 21.7391 ext3_permission 000082d0 3 13.0435 ext3_find_entry 00007010 2 8.69565 ext3_do_update_inode 00006af0 2 8.69565 ext3_get_inode_loc 00004610 2 8.69565 ext3_getblk 00004160 2 8.69565 ext3_get_block_handle 00001db0 2 8.69565 ext3_open_file 000055e0 1 4.34783 ext3_releasepage 00004a90 1 4.34783 ext3_prepare_write 00003aa0 1 4.34783 ext3_get_branch 00003960 1 4.34783 ext3_block_to_path 00001860 1 4.34783 ext3_check_dir_entry 00011020 0 0 __constant_memcpy ...