Instruction counting

Regis Hoffman Regis.Hoffman at fas.ri.cmu.edu
Tue Jul 25 23:20:00 AEST 1989


I am looking for a way to count the number of instructions (especially
floating point) executed in a program running under SUN OS (on a SUN
3/160). Apparently the way to do this is to use ptrace() (to enable
process tracing), but the manual entry is not very clear. Can anyone
answer these questions or even better, have a program to count
instructions?

- PTRACE_GETREGS returns the process' registers. Does the PC point to the
instruction that caused the trace exception, or does it point to the
exception handler that processes the trace? If the latter, then the stack
must be examined to determine the PC of the instruction?

- What is the difference between PTRACE_PEEKUSER and PTRACE_GETREGS in
regard to obtaining the PC?  Both appear to return register information.

Any other thoughts/comments will be appreciated.

	Regis Hoffman (rmh at fas.ri.cmu.edu)



More information about the Comp.sys.sun mailing list