A method and system for compensating for instrumentation overhead in trace
data is provided. To profile a program, the program is executed to
generate trace records that are written to a trace file. A set of event
trace records in a trace file is processed to determine one or more trace
overhead compensation values. The trace overhead compensation values are
determined by computing, for each successive pair of event trace records
in the trace file, a difference between a first timestamp in a preceding
event trace record and a second timestamp in a succeeding event trace
record. The minimum value of all of these differences is then stored as a
trace overhead compensation value representing an amount of time for
instrumentation processing of an event. The one or more trace overhead
compensation values are applied to the event trace records during
subsequent processing of the set of event trace records.