现在的位置: 首页 > 综合 > 正文

Linux oprofile 使用

2018年05月19日 ⁄ 综合 ⁄ 共 1974字 ⁄ 字号 评论关闭

为了找到我们Android 2.3@众志小本上的性能瓶颈,我们使用功能强大的linux性能分析工具oprofile

 

首先,我们需要内核的支持。所以,要求北大编译了一个支持Oprofile的内核版本。

 

其次,如何使用?

 

opcontrol --setup

opcontrol --start

opcontrol --stop

 

然后,查看分析报告

opreport

 

  1. CPU: CPU with timer interrupt, speed 0 MHz (estimated)  
  2. Profiling through timer interrupt  
  3.           TIMER:0|  
  4.   samples|      %|  
  5. ------------------  
  6.      3447 15.3452 Xunigfx  
  7.      3358 14.9490 libvcllu.so  
  8.      3062 13.6313 libswlu.so  
  9.      2139  9.5223 no-vmlinux  
  10.      1571  6.9937 libuno_sal.so.3  
  11.      1512  6.7311 libcairo.so.2.10800.4  
  12.      1417  6.3082 libpthread-2.9.so  
  13.       801  3.5659 libgcc_s.so.1  
  14.       791  3.5213 libc-2.9.so  
  15.       743  3.3077 libfreetype.so.6.3.20  
  16.       740  3.2943 libsvxlu.so  
  17.       415  1.8475 libsvllu.so  
  18.       367  1.6338 soffice.bin  
  19.       267  1.1886 libtllu.so  

 

也可以使用opreport -d 查看所有的细节,包括函数链接符号的地址。

然后通过objdump结合虚拟地址来查看函数名。

 

另外我们可以发现,在android 2.3/externl/目录下也有个oprofile。对于这个层的oprofile,我们有同学有研究:

http://hi.baidu.com/snownight/blog/item/6d81c3ce305fc11193457e56.html

 

具体的Oprofile详细介绍参见:

http://www.ibm.com/developerworks/cn/linux/l-oprof/

 

 

补充:

出现的问题:

 opcontrol --init

 

cat: can't open '/dev/oprofile/cpu_type': No such file or directory

Unable to open cpu_type file for reading

Make sure you have done opcontrol --init

cpu_type 'unset' is not valid

you should upgrade oprofile or force the use of timer mode

解决:

mount -t oprofilefs nodev /dev/oprofile

 

 

http://blog.csdn.net/Kasmile/archive/2009/07/30/4393482.aspx

 

http://blog.csdn.net/louieuser/archive/2011/01/19/6152175.aspx

Arm平台Oprofile移植

 

 

来自:http://blog.csdn.net/fengkehuan/article/details/6309674

【上篇】
【下篇】

抱歉!评论已关闭.