Interface ThreadSampler


  • public interface ThreadSampler
    The ThreadSampler interfaces allows a profiler to choose between portable and VM specific implementations of thread sampling.
    • Method Detail

      • setDepth

        void setDepth​(int depth)
        Used to specify the maximum stack depth to collect.
      • getStackTrace

        StackTraceElement[] getStackTrace​(Thread thread)
        Return a stack trace for the current thread limited by the maximum depth specified by 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.