Performing call stack sampling by setting affinity of target thread to a current process to prevent target thread migration
First Claim
1. A computer program product comprising a computer useable medium having a computer readable program, wherein the computer readable program when executed on a computer causes the computer to:
- generate an interrupt based on an event;
capture information, with an interrupt handler, for an interrupted thread on a current processor from among a plurality of processors;
set an affinity of the interrupted thread such that the interrupted thread runs only on the current processor without being able to migrate to a different processor from among the plurality of processors;
retrieve, with a profiler thread that runs on the current processor, a call stack associated with the interrupted thread after the affinity of the interrupted thread has been set to the current processor; and
restore the affinity of the interrupted thread after the call stack has been retrieved.
1 Assignment
0 Petitions
Accused Products
Abstract
A sample is generated based on an event. Further, an interrupt handler captures information for an interrupted thread on a current processor. In addition, an affinity of the interrupted thread is set such that the interrupted thread runs only on the current processor without being able to migrate to a different processor. A sampler thread that runs on the current processor retrieves a call stack associated with the interrupted thread after the affinity of the interrupted thread has been set to the current processor. The affinity of the interrupted thread is restored after the call stack has been retrieved.
238 Citations
25 Claims
-
1. A computer program product comprising a computer useable medium having a computer readable program, wherein the computer readable program when executed on a computer causes the computer to:
-
generate an interrupt based on an event; capture information, with an interrupt handler, for an interrupted thread on a current processor from among a plurality of processors; set an affinity of the interrupted thread such that the interrupted thread runs only on the current processor without being able to migrate to a different processor from among the plurality of processors; retrieve, with a profiler thread that runs on the current processor, a call stack associated with the interrupted thread after the affinity of the interrupted thread has been set to the current processor; and restore the affinity of the interrupted thread after the call stack has been retrieved. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8)
-
-
9. A method comprising:
-
generating a sample based on an event; capture information, with an interrupt handler, for an interrupted thread on a current processor from among a plurality of processors; setting an affinity of the interrupted thread such that the interrupted thread runs only on the current processor without being able to migrate to a different processor from among the plurality of processors; retrieving, with a profiler thread that runs on the current processor, a call stack associated with the interrupted thread after the affinity of the interrupted thread has been set to the current processor; and restoring the affinity of the interrupted thread after the call stack has been retrieved. - View Dependent Claims (10, 11, 12, 13, 14, 15, 16)
-
-
17. A system comprising:
-
a current processor from among a plurality of processors that generates an interrupt based on an event; an operating system that (i) captures information, with an interrupt handler, for an interrupted thread on the current processor and (ii) sets an affinity of the interrupted thread such that the interrupted thread runs only on the current processor without being able to migrate to a different processor from among the plurality of processors; a profiler that (i) retrieves, with a profiler thread that runs on the current processor, a call stack associated with the interrupted thread after the affinity of the interrupted thread has been set to the current processor. - View Dependent Claims (18, 19, 20, 21, 22, 23, 24)
-
-
25. A computer program product comprising a computer useable medium having a computer readable program, wherein the computer readable program when executed on a computer causes the computer to:
-
generate, with a current processor from among a plurality of processors, an interrupt based on an event; capture information, with an interrupt handler, for an interrupted thread on the current processor; set an affinity of the interrupted thread such that the interrupted thread runs only on the current processor without being able to migrate to a different processor from among the plurality of processors; retrieve, with a profiler thread that runs on the current processor, a call stack associated with the interrupted thread after the affinity of the interrupted thread has been set to the current processor; and restore the affinity of the interrupted thread after the call stack has been retrieved; compare a current instruction pointer to an instruction pointer captured at a time of the interrupt to detect thread drift; and correct the thread drift upon the detection.
-
Specification