Class SolarisOSProcess
- All Implemented Interfaces:
OSProcess
/proc parsing, command-line/env memoization, thread enumeration, and
field assignment are shared (via AbstractProcOSProcess); concrete subclasses (JNA/FFM) provide the
queryArgsEnv read, the self-process rlimit read, and the OSThread factory.-
Nested Class Summary
Nested classes/interfaces inherited from interface OSProcess
OSProcess.StateModifier and TypeInterfaceDescriptionstatic enumProcess and Thread Execution States -
Field Summary
Fields inherited from class AbstractProcOSProcess
commandLineBackup, group, groupID, privateResidentMemory, residentSetSize, user, userIDFields inherited from class AbstractOSProcess
bytesRead, bytesWritten, kernelTime, name, parentProcessID, path, priority, startTime, state, threadCount, upTime, userTime, virtualSizeModifier and TypeFieldDescriptionprotected longprotected longprotected longprotected Stringprotected intprotected Stringprotected intprotected longprotected OSProcess.Stateprotected intprotected longprotected longprotected long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongGets the process affinity mask for this process.longThe number of involuntary context switches the process has made.longGets the number of major (hard) faults the process has made which have required loading a memory page from disk.longGets the number of minor (soft) faults the process has made which have not required loading a memory page from disk.protected static longgetProcessOpenFileLimit(long processId, int index) Parses the soft or hard open-file limit for another process fromplimit.protected SolarisPsInfoReturns the memoizedpsinfofor this process, for subclasses that need its arg/env offset pointers.static OSProcess.StategetStateFromOutput(char stateValue) Returns Enum STATE for the state value obtained from status string of thread/process.longThe number of voluntary context switches the process has made.Reads this process's argument list and environment.Reads this process's argument list and environment.booleanAttempts to update process attributes.Methods inherited from class AbstractProcOSProcess
createThread, getArguments, getBitness, getCommandLine, getCurrentWorkingDirectory, getEnvironmentVariables, getGroup, getGroupID, getOpenFiles, getPrivateResidentMemory, getResidentMemory, getThreadDetails, getUser, getUserIDModifier and TypeMethodDescriptionprotected abstract OSThreadcreateThread(int lwpid) Creates a platform-specificOSThreadfor the given lwpid of this process.Makes a best effort attempt to get a list of the the command-line arguments of the process.intAttempts to get the bitness (32 or 64) of the process.Gets the process command line used to start the process, including arguments if available to be determined.Makes a best effort attempt to obtain the current working directory for the process.Makes a best effort attempt to obtain the environment variables of the process.getGroup()Gets the group under which the process is executing.Gets the group id under which the process is executing.longGets the number of open file handles (or network connections) that belongs to the process.longReturns an estimate of the portion of physical memory (RAM) uniquely attributed to this process.longReturns the total amount of physical memory (RAM) currently mapped to the process's address space.Retrieves the threads of the process and their details.getUser()Gets the user name of the process owner.Gets the user id of the process owner.Methods inherited from class AbstractOSProcess
getBytesRead, getBytesWritten, getKernelTime, getName, getParentProcessID, getPath, getPriority, getProcessCpuLoadBetweenTicks, getProcessCpuLoadCumulative, getProcessID, getStartTime, getState, getThreadCount, getUpTime, getUserTime, getVirtualSize, toStringModifier and TypeMethodDescriptionlongGets the bytes read by the process.longGets the bytes written by the process.longGets kernel/system (privileged) time used by the process.getName()Gets the name of the process, often the executable program.intGets the process ID of this process's parent.getPath()Gets the full filesystem path of the executing process.intGets the priority of this process.doublegetProcessCpuLoadBetweenTicks(OSProcess priorSnapshot) Gets CPU usage of this process since a previous snapshot of the same process, provided as a parameter.doubleGets cumulative CPU usage of this process.intGets the process ID.longGets the process start time.getState()Gets the process state.intGets the number of threads being executed by this process.longGets up time / elapsed time since the process started.longGets user time used by the process.longGets the Virtual Memory Size (VSZ).toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface OSProcess
getContextSwitches, getHardOpenFileLimit, getSoftOpenFileLimitModifier and TypeMethodDescriptiondefault longA snapshot of the context switches the process has done, equal to the sum ofOSProcess.getVoluntaryContextSwitches()andOSProcess.getInvoluntaryContextSwitches()on platforms that provide the split.longGets the hard limit for open file handles (or network connections) that belong to the given process.longGets the soft limit for open file handles (or network connections) of the given process.
-
Constructor Details
-
SolarisOSProcess
protected SolarisOSProcess(int pid)
-
-
Method Details
-
getPsInfo
Returns the memoizedpsinfofor this process, for subclasses that need its arg/env offset pointers.- Returns:
- the parsed
SolarisPsInfo, ornullif it could not be read
-
queryCommandlineEnvironment
Description copied from class:AbstractProcOSProcessReads this process's argument list and environment.- Specified by:
queryCommandlineEnvironmentin classAbstractProcOSProcess- Returns:
- a pair of (arg list, env map); either may be empty if it cannot be read
-
getMinorFaults
public long getMinorFaults()Description copied from interface:OSProcessGets the number of minor (soft) faults the process has made which have not required loading a memory page from disk. Sometimes called reclaims.On Windows, this includes the total of major and minor faults.
Not available on AIX.
- Returns:
- minor page faults (reclaims).
-
getMajorFaults
public long getMajorFaults()Description copied from interface:OSProcessGets the number of major (hard) faults the process has made which have required loading a memory page from disk.Windows does not distinguish major and minor faults at the process level, so this value returns 0 and major faults are included in
OSProcess.getMinorFaults().Not available on AIX.
- Returns:
- major page faults.
-
getVoluntaryContextSwitches
public long getVoluntaryContextSwitches()Description copied from interface:OSProcessThe number of voluntary context switches the process has made. A voluntary context switch occurs when a process gives up the CPU before its time slice expires (e.g., waiting for I/O).For the current process,
getrusage(RUSAGE_SELF)is used on supported POSIX platforms, which aggregates across all threads. For other processes, platform-specific sources are used (/proc/[pid]/statuson Linux,pson FreeBSD/OpenBSD,/proc/[pid]/usageon Solaris). On macOS, the split is only available for the current process; for other processes this returns 0.- Returns:
- voluntary context switches if available, 0 otherwise.
-
getInvoluntaryContextSwitches
public long getInvoluntaryContextSwitches()Description copied from interface:OSProcessThe number of involuntary context switches the process has made. An involuntary context switch occurs when the scheduler preempts the process (e.g., time slice expired).For the current process,
getrusage(RUSAGE_SELF)is used on supported POSIX platforms, which aggregates across all threads. For other processes, platform-specific sources are used (/proc/[pid]/statuson Linux,pson FreeBSD/OpenBSD,/proc/[pid]/usageon Solaris). On macOS, the split is only available for the current process; for other processes this returns 0.- Returns:
- involuntary context switches if available, 0 otherwise.
-
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.
-
getStateFromOutput
Returns Enum STATE for the state value obtained from status string of thread/process.- Parameters:
stateValue- state value from the status string- Returns:
- The state
-
getProcessOpenFileLimit
protected static long getProcessOpenFileLimit(long processId, int index) Parses the soft or hard open-file limit for another process fromplimit.- Parameters:
processId- the process IDindex-1for the soft limit,2for the hard limit- Returns:
- the limit, or
-1if unavailable
-
queryArgsEnv
-