LeC*_*k2k 10
我最终使用了一个微不足道但又有效的解决方案.
display/i $pc
配置了一个简单的gdb脚本,该脚本在我需要分析的函数中断,并按指令继续执行步骤:
set $i=0
break main
run
while ($i<100000)
si
set $i = $i + 1
end
quit
分析日志以计算特定的指令调用.
原油,但它的工作原理......
Linux工具perf将为您提供大量的分析信息; 具体而言,perf annotate将为您提供每指令相对计数.
可以向下钻取到指令级别perf annotate.为此,您需要perf annotate使用命令的名称来调用以进行注释.带有样本的所有函数将被反汇编,每条指令将报告其相对百分比的样本:perf record ./noploop 5 perf annotate -d ./noploop ------------------------------------------------ Percent | Source code & Disassembly of noploop.noggdb ------------------------------------------------ : : : : Disassembly of section .text: : : 08048484 <main>: 0.00 : 8048484: 55 push %ebp 0.00 : 8048485: 89 e5 mov %esp,%ebp [...] 0.00 : 8048530: eb 0b jmp 804853d <main+0xb9> 15.08 : 8048532: 8b 44 24 2c mov 0x2c(%esp),%eax 0.00 : 8048536: 83 c0 01 add $0x1,%eax 14.52 : 8048539: 89 44 24 2c mov %eax,0x2c(%esp) 14.27 : 804853d: 8b 44 24 2c mov 0x2c(%esp),%eax 56.13 : 8048541: 3d ff e0 f5 05 cmp $0x5f5e0ff,%eax 0.00 : 8048546: 76 ea jbe 8048532 <main+0xae> [...]
| 归档时间: |
|
| 查看次数: |
4054 次 |
| 最近记录: |