A system and method for collecting a plurality of metrics during a single
run of a computer program. The mechanism of the present invention
initializes a plurality of counters to count events associated with
metrics of interest. The mechanism of the present invention then counts
the occurrence of events associated with metrics of interest during a
single execution of a computer program. Responsive to a determination
that a counter in a plurality of counters has generated an interrupt, the
interrupt is rerouted to an interrupt handler, wherein the interrupt
handler generates trace records comprising trace information
corresponding to the interrupt. The mechanism of the present invention
then generates profiles for the trace records, wherein the profiles
differentiate the trace records based on the metric type associated with
each trace record.