1.使用tracepoint
当perf根据tick时间点进行采样后,人们便能够得到内核代码中的hotspot。那什么时候需要使用tracepoint来采样呢?
我想人们使用tracepoint的基本需求是对内核的运行时行为的关心,如前所述,有些内核开发人员需要专注于特定的子系统,比如内存管理模块。这便需要统计相关内核函数的运行情况。另外,内核行为对应用程序性能的影响也是不容忽视的:
以之前的遗憾为例,假如时光倒流,我想我要做的是统计该应用程序运行期间究竟发生了多少次系统调用。在哪里发生的?
下面我用ls命令来演示sys_enter这个tracepoint的使用:
[root
ovispoly/]#perfstat-eraw_syscalls:sys_enterlsbindbgetclibmediaoptrootselinuxsysusr
bootdevhomelost+foundmntprocsbinsrvtmpvar
Performancecounterstatsforls:
raw_syscalls:sys_enter
0.secondstimeelapsed
[root
ovispoly/]#perfrecord-eraw_syscalls:sys_enterls[root
ovispoly/]#perfreportFailedtoopen.lib/ld-2.12.so,continuingwithoutsymbols
#Samples:70
#
#OverheadCommandSharedObjectSymbol
97.14%lsld-2.12.so[.]0x9d
2.86%ls[vdso][.]0x24
#
#(Forahigherleveloverview,try:perfreport--sort北京现在治疗白癜风要多少钱头部白癜风怎么治疗最好