public interface ThreadSampler
ThreadSampler interfaces allows a profiler to choose
between portable and VM specific implementations of thread
sampling.| Modifier and Type | Method and Description |
|---|---|
StackTraceElement[] |
getStackTrace(Thread thread)
Return a stack trace for the current thread limited by the
maximum depth specified by
setDepth. |
void |
setDepth(int depth)
Used to specify the maximum stack depth to collect.
|
void setDepth(int depth)
StackTraceElement[] getStackTrace(Thread thread)
setDepth. May
return null if no sample is availble for the thread, which may
happen in cases such as thread termination. The resulting array
should be copied before the next call to getStackTrace
if the caller wants to use the results, since the ThreadSampler may reuse the array. Note that the elements
themselves are immutable and do not need to be copied.