yza*_*ark 4 linux performance perf
您可能已经阅读过这个问题: 如何在我的程序中获得性能以查找符号
1)我的问题是:
当我使用 perf report 时,它给出了这样的结果:
# Overhead Command Shared Object Symbol
# . .
#
99.59% test test [.] 0x000003d4
0.21% test [kernel.kallsyms] [k] __do_fault
0.10% test [kernel.kallsyms] [k] run_timer_softirq
0.10% test [kernel.kallsyms] [k] __update_cpu_load
0.01% test [kernel.kallsyms] [k] set_task_comm
0.00% test [kernel.kallsyms] [k] intel_pmu_enable_all
Run Code Online (Sandbox Code Playgroud)
也就是说:perf 可以在内核中找到符号,但在我的程序中找不到符号。
我的程序在这里:
void longa()
{
int i,j;
for(i = 0; i < 1000000; i++)
j=i; //am I silly or crazy? I feel boring and desperate.
}
void foo2()
{
int i;
for(i=0 ; i < 10; i++)
longa();
}
void foo1()
{
int i;
for(i = 0; i< 100; i++)
longa();
}
int main(void)
{
foo1();
foo2();
}
Run Code Online (Sandbox Code Playgroud)
2)我已经编译了程序,如:
gcc test.c -g -o 测试
我的环境:os:ubuntu kernel:3.10.9
今天,当我跑步时perf test,我收到一条消息说vmlinux symtab matches kallsyms: Failed。
找原因的时候,发现原因是 的值/proc/sys/kernel/kptr_restrict是1,当我们把它设置为 时0,我们的程序中就会得到这个符号。
| 归档时间: |
|
| 查看次数: |
6235 次 |
| 最近记录: |