x86 程序集分析
有谁知道一个可以给我 x86 指令执行计数的好工具。我看过 gcov,但想看看其他可能对我有帮助的选项。我的最终目标是能够调用此函数并为其提供我感兴趣的模拟/分析函数,并且它将返回每个装配线执行的次数。 欢迎任何建议:) 谢谢
Does anyone know a good tool that would give me x86 instruction execution count. I have looked at gcov, but would like to look at other option that might help me. My Ultimate goal is to be able to call this function and give it the function I am interested in emulating/profiling and it would return the number of times each assembly line executed.
Any suggestions are welcome :)
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Qemu 可以提供帮助,但无论如何这种分析都会破坏您的缓存/管道配置文件并且不会有用。
Qemu could help, but any way this kind of profiling will ruin your cache/pipeline profile and won't be useful.
如果您正在寻找占用大量时间的指令,并且可以在调试器下运行它,那么 这会起作用。
它将隔离负责重要时间的代码点,无论它们是终端指令还是函数调用指令,即使它们会导致 I/O。
可以执行此操作的工具是 Zoom(如果您使用的是 Linux),或者 LTProf(如果在 Windows 上)。
另一方面,如果您正在寻找时间测量和执行计数,您将需要其他东西,例如模拟器(Valgrind?)。
If you are looking for instructions that account for a significant percent of time, and if you can run it under a debugger, then this will work.
It will isolate code points that are responsible for significant time, whether they are terminal instructions or function call instructions, even if they cause I/O.
Tools that will do this are Zoom, if you are on Linux, or LTProf if on Windows.
On the other hand, if you are looking for time measurement and execution counting, you will need something else, like an emulator (Valgrind?).
AMD 的代码分析师应该能够使用基于指令的采样来做到这一点,但我不记得它是否给出了执行计数的百分比或固定数字。
AMD's code analyst should be able to do this using instruction based sampling, I can't remember if it gives percentages or flat numbers for execution counts though.
您可以在 Linux 上轻松地组合出这样的程序,只需使用 ptrace 即可
结合
objdump
和一些逻辑,应该很容易用asm
编写。我从如何编写调试器中得到了这个想法。
You could slap together a program like that pretty easily on Linux, just use
ptrace
in combination with
objdump
and some logic, should be easy to write inasm
.I got the idea from How to code debuggers.