Patent ID: 8365187

Claim:
A device comprising: one or more processors to: use an operating system to schedule a first process, of a plurality of processes, as an active process that is to be executed by the one or more processors, sample a value of an instruction pointer that indicates an instruction in the first process that is currently being executed by the one or more processors, add the value to a data structure that includes values sampled after a last time when the data structure was cleared, update profile data based on the value, determine an occurrence of a context switch that includes the operating system switching the active process from the first process to a second process of the plurality of processes, determine, after the determining of the occurrence of the context switch, whether the first process executes for longer than a particular length of time, stop profiling of the first process when the first process executes for longer than the particular length of time, and clear, when the first process fails to execute for longer than the particular length of time, the profile data by zeroing out only particular count values corresponding to the values sampled after the last time the data structure was cleared, the particular count values being a subset of a set of possible count values included in the profile data.