Package oshi.software.os.linux
Class LinuxOSThread
java.lang.Object
oshi.software.common.AbstractOSThread
oshi.software.os.linux.LinuxOSThread
- All Implemented Interfaces:
OSThread
public class LinuxOSThread extends AbstractOSThread
-
Constructor Summary
Constructors Constructor Description LinuxOSThread(int processId, int tid)
-
Method Summary
Modifier and Type Method Description long
getContextSwitches()
A snapshot of the context switches the thread has done.long
getKernelTime()
Kernel (privileged) time used by the thread.long
getMajorFaults()
The number of major (hard) faults the thread has made which have required loading a memory page from disk.long
getMinorFaults()
The number of minor (soft) faults the thread has made which have not required loading a memory page from disk.int
getPriority()
Priority of the thread, the meaning of which is dependent on the OS.long
getStartMemoryAddress()
The memory address above which this thread can run.long
getStartTime()
The start time of the thread.OSProcess.State
getState()
Getter for the fieldstate
.int
getThreadId()
The thread id.long
getUpTime()
Elapsed/up-time of the thread.long
getUserTime()
User time used by the thread.boolean
updateAttributes()
Attempts to updates process attributes.Methods inherited from class oshi.software.common.AbstractOSThread
getName, getOwningProcessId, getThreadCpuLoadBetweenTicks, getThreadCpuLoadCumulative, toString
-
Constructor Details
-
LinuxOSThread
public LinuxOSThread(int processId, int tid)
-
-
Method Details
-
getThreadId
public int getThreadId()Description copied from interface:OSThread
The thread id. The meaning of this value is OS-dependent.- Returns:
- Returns the id of the thread.
-
getState
Description copied from interface:OSThread
Getter for the field
state
.- Returns:
- Returns the execution state of the task/thread.
-
getStartTime
public long getStartTime()Description copied from interface:OSThread
The start time of the thread.- Returns:
- Returns the start time of the task/thread in number of milliseconds since January 1, 1970.
-
getStartMemoryAddress
public long getStartMemoryAddress()Description copied from interface:OSThread
The memory address above which this thread can run.- Specified by:
getStartMemoryAddress
in interfaceOSThread
- Overrides:
getStartMemoryAddress
in classAbstractOSThread
- Returns:
- The start address.
-
getContextSwitches
public long getContextSwitches()Description copied from interface:OSThread
A snapshot of the context switches the thread has done. Since the context switches could be voluntary and non-voluntary, this gives the sum of both.- Specified by:
getContextSwitches
in interfaceOSThread
- Overrides:
getContextSwitches
in classAbstractOSThread
- Returns:
- sum of both voluntary and involuntary context switches.
-
getMinorFaults
public long getMinorFaults()Description copied from interface:OSThread
The number of minor (soft) faults the thread has made which have not required loading a memory page from disk. Sometimes called reclaims. Linux only.- Specified by:
getMinorFaults
in interfaceOSThread
- Overrides:
getMinorFaults
in classAbstractOSThread
- Returns:
- minor faults.
-
getMajorFaults
public long getMajorFaults()Description copied from interface:OSThread
The number of major (hard) faults the thread has made which have required loading a memory page from disk. Linux only.- Specified by:
getMajorFaults
in interfaceOSThread
- Overrides:
getMajorFaults
in classAbstractOSThread
- Returns:
- major faults.
-
getKernelTime
public long getKernelTime()Description copied from interface:OSThread
Kernel (privileged) time used by the thread.- Returns:
- Returns the number of milliseconds the task/thread has executed in kernel/system mode.
-
getUserTime
public long getUserTime()Description copied from interface:OSThread
User time used by the thread.- Returns:
- Returns the number of milliseconds the task/thread has executed in user mode.
-
getUpTime
public long getUpTime()Description copied from interface:OSThread
Elapsed/up-time of the thread.- Returns:
- Returns the number of milliseconds since the task/thread started.
-
getPriority
public int getPriority()Description copied from interface:OSThread
Priority of the thread, the meaning of which is dependent on the OS.- Returns:
- priority.
-
updateAttributes
public boolean updateAttributes()Description copied from interface:OSThread
Attempts to updates process attributes. Returns false if the update fails, which will occur if the process no longer exists. Not implemented for macOS, as thread ID is simply an index and not unique.- Specified by:
updateAttributes
in interfaceOSThread
- Overrides:
updateAttributes
in classAbstractOSThread
- Returns:
true
if the update was successful, false if the update failed. In addition, on a failed update the thread state will be changed toOSProcess.State.INVALID
.
-