Patent ID: 8418152

Claim:
A method of profiling a process executing on a processor, the method comprising: allocating a small pinned buffer and a larger unpinned histogram buffer in a memory; recording, in the small pinned buffer, a plurality of program counters encountered while executing the process; incrementing a buffer counter each time one of the plurality of program counters is written to the small pinned buffer; setting a profiling signal in response to comparing the buffer counter to a threshold value, wherein the threshold value is less than or equal to the number of program counters are able to be written to the small pinned buffer, and wherein the setting of the profiling signal indicates reaching the threshold value; in response to reaching the threshold value: for each program counter recorded in the small pinned buffer: calculating a slot within the histogram buffer that corresponds to the program counter; reading a counter from the calculated slot; incrementing the counter; and writing the counter back to the calculated slot; and clearing the small pinned buffer.