Class WindowsOSProcessJNA
java.lang.Object
oshi.software.common.AbstractOSProcess
oshi.software.common.os.windows.WindowsOSProcess
oshi.software.os.windows.WindowsOSProcessJNA
- All Implemented Interfaces:
OSProcess
JNA-based Windows OS process implementation.
-
Nested Class Summary
Nested classes/interfaces inherited from interface OSProcess
OSProcess.State -
Field Summary
Fields inherited from class WindowsOSProcess
MAX_WINDOWS_HANDLES, USE_BATCH_COMMANDLINE, USE_PROCSTATE_SUSPENDED -
Constructor Summary
ConstructorsConstructorDescriptionWindowsOSProcessJNA(int pid, WindowsOperatingSystemJNA os, Map<Integer, ProcessPerfCounterBlock> processMap, Map<Integer, WtsInfo> processWtsMap, Map<Integer, ThreadPerfCounterBlock> threadMap) -
Method Summary
Modifier and TypeMethodDescriptionprotected OSThreadcreateOSThread(int pid, int tid, String procName, ThreadPerfCounterBlock pcb) Creates a platform-specific OS thread instance.longGets the process affinity mask for this process.Queries the argument list for this process.protected StringQueries the command line for this process.Queries the current working directory, command line, and environment variables from process memory.Queries group account information for this process.protected Map<Integer, ThreadPerfCounterBlock> queryMatchingThreads(Set<Integer> pids) Queries thread performance data matching the given process IDs.Queries user account information for this process.booleanAttempts to update process attributes.protected booleanupdateAttributes(ProcessPerfCounterBlock pcb, WtsInfo wts) Updates process attributes from performance counter and WTS data, then performs native-specific updates.Methods inherited from class WindowsOSProcess
defaultCwdCommandlineEnvironment, defaultPair, getArguments, getBitness, getBytesRead, getBytesWritten, getCommandLine, getCurrentWorkingDirectory, getCwdCmdEnv, getEnvironmentVariables, getGroup, getGroupID, getHardOpenFileLimit, getKernelTime, getMinorFaults, getName, getOpenFiles, getOs, getParentProcessID, getPath, getPriority, getPrivateResidentMemory, getResidentMemory, getSoftOpenFileLimit, getStartTime, getState, getThreadCount, getThreadDetails, getUpTime, getUser, getUserID, getUserTime, getVirtualSize, setBitness, setName, setPath, setState, setTcbMethods inherited from class AbstractOSProcess
getProcessCpuLoadBetweenTicks, getProcessCpuLoadCumulative, getProcessID, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface OSProcess
getContextSwitches, getInvoluntaryContextSwitches, getMajorFaults, getVoluntaryContextSwitches
-
Constructor Details
-
WindowsOSProcessJNA
public WindowsOSProcessJNA(int pid, WindowsOperatingSystemJNA os, Map<Integer, ProcessPerfCounterBlock> processMap, Map<Integer, WtsInfo> processWtsMap, Map<Integer, ThreadPerfCounterBlock> threadMap)
-
-
Method Details
-
getAffinityMask
public long getAffinityMask()Description copied from interface:OSProcessGets the process affinity mask for this process.On Windows systems with more than 64 processors, if the threads of the calling process are in a single processor group, returns the process affinity mask for that group (which may be zero if the specified process is running in a different group). If the calling process contains threads in multiple groups, returns zero.
Because macOS does not export interfaces that identify processors or control thread placement, explicit thread to processor binding is not supported and this method will return a bitmask of all logical processors.
If the Operating System fails to retrieve an affinity mask (e.g., the process has terminated), returns zero.
- Returns:
- a bit vector in which each bit represents the processors that a process is allowed to run on.
-
updateAttributes
public boolean updateAttributes()Description copied from interface:OSProcessAttempts to update process attributes. Returns false if the update fails, which will occur if the process no longer exists.- Returns:
trueif the update was successful, false if the update failed. In addition, on a failed update the process state will be changed toOSProcess.State.INVALID.
-
updateAttributes
Description copied from class:WindowsOSProcessUpdates process attributes from performance counter and WTS data, then performs native-specific updates. Subclasses should callsuper.updateAttributes(pcb, wts)and then perform native handle-based updates.- Overrides:
updateAttributesin classWindowsOSProcess- Parameters:
pcb- Performance counter block for this process, or null if unavailablewts- WTS info for this process, or null if unavailable- Returns:
- true if the process is valid after the update
-
createOSThread
Description copied from class:WindowsOSProcessCreates a platform-specific OS thread instance.- Specified by:
createOSThreadin classWindowsOSProcess- Parameters:
pid- the owning process IDtid- the thread IDprocName- the process namepcb- the thread performance counter block- Returns:
- a new OSThread instance
-
queryMatchingThreads
Description copied from class:WindowsOSProcessQueries thread performance data matching the given process IDs.- Specified by:
queryMatchingThreadsin classWindowsOSProcess- Parameters:
pids- the set of process IDs to match- Returns:
- a map of thread ID to thread performance counter block
-
queryCommandLine
Description copied from class:WindowsOSProcessQueries the command line for this process.- Specified by:
queryCommandLinein classWindowsOSProcess- Returns:
- the command line string
-
queryArguments
Description copied from class:WindowsOSProcessQueries the argument list for this process.- Specified by:
queryArgumentsin classWindowsOSProcess- Returns:
- the list of arguments
-
queryUserInfo
Description copied from class:WindowsOSProcessQueries user account information for this process.- Specified by:
queryUserInfoin classWindowsOSProcess- Returns:
- a pair of (account name, SID string)
-
queryGroupInfo
Description copied from class:WindowsOSProcessQueries group account information for this process.- Specified by:
queryGroupInfoin classWindowsOSProcess- Returns:
- a pair of (group name, SID string)
-
queryCwdCommandlineEnvironment
Description copied from class:WindowsOSProcessQueries the current working directory, command line, and environment variables from process memory.- Specified by:
queryCwdCommandlineEnvironmentin classWindowsOSProcess- Returns:
- a triplet of (cwd, commandLine, environmentVariables)
-