Class AbstractOSThread
java.lang.Object
oshi.software.common.AbstractOSThread
- All Implemented Interfaces:
OSThread
- Direct Known Subclasses:
AixOSThread, DragonFlyBsdOSThread, FreeBsdOSThread, LinuxOSThread, MacOSThread, NetBsdOSThread, OpenBsdOSThread, SolarisOSThread, WindowsOSThread
Common methods for OSThread implementation
-
Nested Class Summary
Nested classes/interfaces inherited from interface OSThread
OSThread.ThreadFilteringModifier and TypeInterfaceDescriptionstatic final classConstants which may be used to filter Thread lists -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractOSThread(int processId) Creates an AbstractOSThread for the given owning process ID. -
Method Summary
Modifier and TypeMethodDescriptionintThe owning process of this thread.doublegetThreadCpuLoadBetweenTicks(OSThread priorSnapshot) Gets CPU usage of this thread since a previous snapshot of the same thread, provided as a parameter.doubleGets cumulative CPU usage of this thread.toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface OSThread
getContextSwitches, getKernelTime, getMajorFaults, getMinorFaults, getName, getPriority, getStartMemoryAddress, getStartTime, getState, getThreadId, getUpTime, getUserTime, updateAttributesModifier and TypeMethodDescriptiondefault longA snapshot of the context switches the thread has done.longKernel (privileged) time used by the thread.default longThe number of major (hard) faults the thread has made which have required loading a memory page from disk.default longThe number of minor (soft) faults the thread has made which have not required loading a memory page from disk.default StringgetName()The name of the thread.intPriority of the thread, the meaning of which is dependent on the OS.default longThe memory address above which this thread can run.longThe start time of the thread.getState()Gets the execution state of the task/thread.intThe thread id.longElapsed/up-time of the thread.longUser time used by the thread.default booleanAttempts to updates process attributes.
-
Constructor Details
-
AbstractOSThread
protected AbstractOSThread(int processId) Creates an AbstractOSThread for the given owning process ID.- Parameters:
processId- the owning process ID
-
-
Method Details
-
getOwningProcessId
public int getOwningProcessId()Description copied from interface:OSThreadThe owning process of this thread. For single-threaded processes, the owning process ID may be the same as the thread's ID.- Specified by:
getOwningProcessIdin interfaceOSThread- Returns:
- The owning process of this thread.
-
getThreadCpuLoadCumulative
public double getThreadCpuLoadCumulative()Description copied from interface:OSThreadGets cumulative CPU usage of this thread.- Specified by:
getThreadCpuLoadCumulativein interfaceOSThread- Returns:
- The proportion of up time that the thread was executing in kernel or user mode.
-
getThreadCpuLoadBetweenTicks
Description copied from interface:OSThreadGets CPU usage of this thread since a previous snapshot of the same thread, provided as a parameter.- Specified by:
getThreadCpuLoadBetweenTicksin interfaceOSThread- Parameters:
priorSnapshot- AnOSThreadobject containing statistics for this same thread collected at a prior point in time. May be null.- Returns:
- If the prior snapshot is for the same thread at a prior point in time, the proportion of elapsed up time between the current thread snapshot and the previous one that the thread was executing in kernel or user mode. Returns cumulative load otherwise.
-
toString
-