2014-11-08 33 views
0

有没有一种方法可以指定perf工具来为可执行文件提供前n条指令的统计信息?由于Perf工具 - 前n条指令的配置文件

+0

要小心“第一条指令”,它们不可能是您想象的那个。请记住,在进入主函数之前,会执行数千条指令(此处超过400.000)。 你的目标是什么?我希望了解,如果可以的话,以提供更准确的帮助。 – amigadev 2014-11-09 08:35:57

回答

0

试试这个

1. perf record -e instructions -c no_of_instrucitons executable_path 
2. sudo perf report -D -i perf.data > test 
3. vi test 
4. Search for "PERF_RECORD_SAMPLE" string 
5. This string should be repeated the number of times equal to the samples taken throughout the execution of the binary 
6. If you remove the samples other than the first one and rename test to perf.data you should have the results after "perf report" 

附:这是所有的近似值。并且确保删除样本时,perf.data标题和页脚应该完好无缺。