x86 assembly profiling
Question
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
Solution
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?).
OTHER TIPS
Qemu could help, but any way this kind of profiling will ruin your cache/pipeline profile and won't be useful.
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.
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 in asm
.
I got the idea from How to code debuggers.