---> During initialization phase, the command can load oprofile.ko module in to kernel, and mount oprfilefs. After that, some files and directories are exported in to /dev/oprofile, such as: cpu_type, dump, enable, pointer_size, stats as so on.
# ./opcontrol --setup --no-vmlinux
---> Configure OProfile not to inspect kernel, if necessary, assign kernel with command : ./opcontrol –setup–vmlinux= /path/to/kernel
# ./opcontrol --start
---> Start up OProfile daemon routine oprofiled, which writes sampled data to /var/lib/oprofile/samples/, the log file is located at /var/lib/oprofile/oprfiled.log
# ./opcontrol --dump
---> The purpose of this command is to read all the sampled data to /var/lib/oprofile/samples/ before the analysis of performance.
#./opcontrol --separate=[none,lib,kernel,thread,cpu,all]
--->Separate samples based on the given separator. ’lib’ separates dynamically linked library samples per application. ’kernel’ separates ker nel and kernel module samples per application; ’kernel’ implies ’library’. ’thread’ gives separation for each thread and task. ’cpu’ separates for each CPU. ’all’ implies all of the above options and ’none’ turns off separation.
#./opcontrol --callgraph=#depth
--->Enable callgraph sample collection with a maximum depth. Use 0 to disable callgraph profiling. This option is available on x86 using a 2.6+ kernel with callgraph support enabled. It is also available on PowerPC using a 2.6.17+ kernel.
#./opcontrol --image=[name,name...|"all"]
--->Only profile the given absolute paths to binaries, or "all" to profile everything (the default).
(1)没有指定内核下的性能监测:
# opcontrol --init
# opcontrol --setup --no-vmlinux
# opcontrol –start
# opcontrol --dump
# opreport
(结果见截图1,截图2)
截图2
# opcontrol --stop
虽然这里配置 OProfile 不监视内核,这个命令还会载入 oprofile 内核模块(如果还没有被载入),并创建 /dev/oprofile/ 目录(如果不存在)。
注记 :即便 OProfile 被配置成不为内核建档,SMP 内核仍旧必须运行,这样,oprofile 模块才会被载入。
(2)指定内核的情况下性能监测:
将编译内核时生成的vmlinux文件复制到nfs中根目录下。
# opcontrol --init
# opcontrol --setup --vmlinux=/home/vmlinux
objdump: not found
The specified file /home/kasmile/vmlinux does not seem to be valid
Make sure you are using the non-compressed image file (e.g. vmlinux not vmlinuz)
分析:
参看oprocontrol源码,由于在指定内核镜像时,会用到objdump 应用程序检测镜像中的.text段内容,而在开发板上面没有交叉编译的objdump应用程序,所以不能通过判断,以至于,即使指定的是未压缩的内核镜像,也被误认为压缩的了。
解决方法:
通过采用附录1中编译静态链接ophelp的具体方法,编译生成静态链接的objdump,然后将binutils-2.19.51.0.3/binutils下的objdump 拷贝到开发板的/usr/bin目录下
重新执行:
# opcontrol --setup --vmlinux=/vmlinux
#opcontrol -s
#opcontrol –d
#opreport
(结果见截图3,截图4)
截图3
截图4