Class WindowsOSThread

java.lang.Object
oshi.software.common.AbstractOSThread
oshi.software.common.os.windows.WindowsOSThread
All Implemented Interfaces:
OSThread

@ThreadSafe public abstract class WindowsOSThread extends AbstractOSThread
Common base class for Windows OS thread implementations.
  • Constructor Details

    • WindowsOSThread

      protected WindowsOSThread(int pid, int tid, String procName, ThreadPerfCounterBlock pcb)
      Constructor.
      Parameters:
      pid - the pid
      tid - the tid
      procName - the procName
      pcb - the pcb
  • 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.
    • getName

      public String getName()
      Description copied from interface: OSThread
      The name of the thread. Presence of a name is operating-system dependent and may include information (such as an index of running threads) that changes during execution.
      Returns:
      Returns the name of the task/thread.
    • getState

      public OSProcess.State getState()
      Description copied from interface: OSThread
      Gets the execution state of the task/thread.
      Returns:
      Returns the execution state of the task/thread.
    • getStartMemoryAddress

      public long getStartMemoryAddress()
      Description copied from interface: OSThread
      The memory address above which this thread can run.
      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.

      Not available on AIX.

      Returns:
      sum of both voluntary and involuntary context switches.
    • 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.
    • 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.
    • 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.
    • getProcName

      protected String getProcName()
      Returns the process name prefix used for thread name construction.
      Returns:
      the process name (portion before "/" in the thread name)
    • updateAttributes

      protected boolean updateAttributes(String procName, ThreadPerfCounterBlock pcb)
      Updates thread attributes from a performance counter block.
      Parameters:
      procName - the owning process name
      pcb - the thread performance counter block, or null if unavailable
      Returns:
      true if the thread is valid after the update