public class ThreadStatistics
extends java.lang.Object
Constructor and Description |
---|
ThreadStatistics(long idToTrack)
Creates a tracker to monitor the specified thread (or a negative number to indicate each call is to refer to whatever the calling thread is)
|
ThreadStatistics(java.lang.Thread thread)
Creates a tracker to monitor the specified thread (or null to indicate each call is to refer to whatever the calling thread is)
|
Modifier and Type | Method and Description |
---|---|
long |
getThreadId()
Returns the id of the thread being tracked (or a negative or 0 value if the calls to this statistics object simply return data about the current thread)
|
long |
getThreadTime()
Returns the amount of time the thread has been active, in nanoseconds, or -1 if the JVM doesn't support thread time operations.
|
boolean |
isThreadEnded()
Returns whether or not the tracked thread is still running (or blocked, etc...
|
java.lang.String |
toString() |
public ThreadStatistics(@Nullable java.lang.Thread thread)
thread
- The thread to track, or null to indicate calls reflect the calling threadpublic ThreadStatistics(long idToTrack)
idToTrack
- The thread id to track, or a negative number to indicate calls reflect the calling threadpublic long getThreadTime()
public long getThreadId()
public boolean isThreadEnded()
public java.lang.String toString()
toString
in class java.lang.Object