A system and method for monitoring the performance of a computer system by dynamically
interposing an instrumented trap table. A base address of a trap table, which may
be contained in a trap base address register, may be changed to indicate an instrumented
trap table. An instrumented trap table may gather a variety of statistics, including
the type of trap and an entry timestamp. An instrumented trap table may then call
a non-instrumented trap table to process the trap. A non-instrumented trap table
may pass control back to the instrumented trap table to collect further statistics,
for example an exit timestamp. An instrumented trap table may then return process
flow to the calling routing. In this manner, useful performance statistics may
be gathered while trap events are processed by regular, optimized software.