Patent ID: 7640539

Claim:
A method in a data processing system, having at least a processor, for profiling program execution on the data processing system, the method comprising: initializing, by the processor, a plurality of counters in a performance monitor unit residing in the processor to count a plurality of events, wherein each event is associated with a different metric, and wherein each counter is associated with one of the different metrics; counting, by each counter, occurrences of events that are associated with each respective counter during execution of a computer program that includes a plurality of branches; responsive to each determination that one of the plurality of counters has generated an interrupt, rerouting, by the processor, the interrupt to an interrupt handler, wherein the interrupt handler generates a separate first trace record in response to each generated interrupt, further wherein each first trace record corresponds to only one interrupt and is associated with only one counter, and further wherein each first trace record includes trace information, wherein the trace information includes an event type that identifies one of the plurality of metrics; responsive to each determination that one of the plurality of branches has been taken during the execution of the computer program, generating a second trace record for the one of the plurality of branches taken, wherein the counting continues without resetting each counter after each one of the plurality of branches has been taken, and wherein the second trace record includes a change in a value of each counter since a last one of the plurality of branches was taken, and wherein the second trace record includes information about the one of the plurality of branches that was taken; and generating profiles for a trace, wherein the profiles differentiate the first trace records using the event type that is included in each one of the plurality of first trace records.