Syntax_Error
Syntax_Error

Reputation: 6210

x86 assembly profiling

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

Upvotes: 2

Views: 3505

Answers (4)

gens
gens

Reputation: 1

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.

Upvotes: 0

Necrolis
Necrolis

Reputation: 26171

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.

Upvotes: 0

Mike Dunlavey
Mike Dunlavey

Reputation: 40649

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?).

Upvotes: 0

SK-logic
SK-logic

Reputation: 9714

Qemu could help, but any way this kind of profiling will ruin your cache/pipeline profile and won't be useful.

Upvotes: 1

Related Questions