A method, apparatus, and computer instructions for providing pre and post
handlers to log trace records before entering or after exiting the
interrupt handler. A trace record includes a `from` address where the
interrupt occurs or where the branch instruction is executed or a `to`
address for the branch to case and counts of selected performance
monitoring events. A timestamp may be associated with each event. In one
embodiment, the pre and post handler is used with trap on branch to log
trace records prior to and immediate after taking a branch. In another
embodiment, a pre handler is enabled to log trace records that occur
prior to executing interrupt service routines. A post handler is enabled
to log trace records that occur after the interrupt service routines is
executed and prior to returning to normal execution. Resulting low-level
performance trace data may be collected by the user at a later time for
more structured performance analysis.