Re: Monitor for run-time code execution?

Tim Newsham <newsham@lava.net>
8 Nov 2003 01:41:10 -0500

          From comp.compilers

Related articles
Monitor for run-time code execution? mohitk_3@ureach.com (2003-10-31)
Re: Monitor for run-time code execution? ppluzhnikov@earthlink.net (Paul Pluzhnikov) (2003-11-08)
Re: Monitor for run-time code execution? newsham@lava.net (Tim Newsham) (2003-11-08)
| List of all articles for this month |
From: Tim Newsham <newsham@lava.net>
Newsgroups: comp.compilers
Date: 8 Nov 2003 01:41:10 -0500
Organization: Compilers Central
References: 03-10-152
Keywords: performance, analysis
Posted-Date: 08 Nov 2003 01:41:10 EST

mohit <mohitk_3@ureach.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.


: Thanks
: Mohit


Tim N.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.