|Monitor for run-time code execution? email@example.com (2003-10-31)|
|Re: Monitor for run-time code execution? firstname.lastname@example.org (Paul Pluzhnikov) (2003-11-08)|
|Re: Monitor for run-time code execution? email@example.com (Tim Newsham) (2003-11-08)|
|From:||Tim Newsham <firstname.lastname@example.org>|
|Date:||8 Nov 2003 01:41:10 -0500|
|Posted-Date:||08 Nov 2003 01:41:10 EST|
mohit <email@example.com> wrote:
: I wanted to get the run-time statistics for the instructions executed
: by a program. i.e. a sample "hello world" program in ansi C performs
: : 5-MOV, 3-LOAD instructions .
: I would be really grateful for the info.
This is pretty easy to do with the ptrace() interface on most unix
boxes. You can single step the entire program and record all the
program/instruction counter addresses and then match this data with
data from disassembly of the program. The tracing code is all of a
page of code and is straightforward.
If you want to get fancier, you can instrument a cpu emulator (such
as bochs) to record similar information (and have access to the
parsed instruction and various cpu internal state), although this
is considerably more work.
Return to the
Search the comp.compilers archives again.