Patent ID: 8799872

Claim:
A computer program product for sampling, the computer program product comprising: a computer readable storage medium having computer readable program code embodied therewith, the computer readable storage medium is not a computer readable signal medium, the computer readable program code comprising: computer readable program code to set an affinity of a target thread such that the target thread runs on a current processor without being able to migrate to a different processor; in response to setting the affinity, computer readable program code to generate a plurality of samples in the computer system to profile and record a plurality of events associated with the target thread; and computer readable program code to accumulate, for each of the plurality of samples, a plurality of partial samples prior to occurrence of each of the plurality of events; and computer readable program code to process a current sample of the plurality of samples in response to (i) completing processing of a previous sample of the plurality of samples and (ii) an accumulated quantity of the pluralities of partial samples exceeding a predetermined threshold quantity.