Class LinuxOSProcessJNA
java.lang.Object
oshi.software.common.AbstractOSProcess
oshi.software.common.os.linux.LinuxOSProcess
oshi.software.os.linux.LinuxOSProcessJNA
- All Implemented Interfaces:
OSProcess
JNA-based Linux OS process. Implements
getrlimit and getrusage via JNA.-
Nested Class Summary
Nested classes/interfaces inherited from interface OSProcess
OSProcess.State -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongThe number of involuntary context switches the process has made.longThe number of voluntary context switches the process has made.protected longQueries the hard open file limit for the current process via nativegetrlimit.protected longQueries the soft open file limit for the current process via nativegetrlimit.booleanAttempts to update process attributes.Methods inherited from class LinuxOSProcess
getAffinityMask, getArguments, getBitness, getBytesRead, getBytesWritten, getCommandLine, getCurrentWorkingDirectory, getEnvironmentVariables, getGroup, getGroupID, getHardOpenFileLimit, getKernelTime, getMajorFaults, getMinorFaults, getName, getOpenFiles, getOs, getParentProcessID, getPath, getPriority, getPrivateResidentMemory, getProcessOpenFileLimit, getResidentMemory, getSoftOpenFileLimit, getStartTime, getState, getThreadCount, getThreadDetails, getUpTime, getUser, getUserID, getUserTime, getVirtualSizeMethods 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
-
Constructor Details
-
LinuxOSProcessJNA
-
-
Method Details
-
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.- Specified by:
updateAttributesin interfaceOSProcess- Overrides:
updateAttributesin classLinuxOSProcess- 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.
-
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.- Specified by:
getVoluntaryContextSwitchesin interfaceOSProcess- Overrides:
getVoluntaryContextSwitchesin classLinuxOSProcess- 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.- Specified by:
getInvoluntaryContextSwitchesin interfaceOSProcess- Overrides:
getInvoluntaryContextSwitchesin classLinuxOSProcess- Returns:
- involuntary context switches if available, 0 otherwise.
-
queryRlimitSoft
protected long queryRlimitSoft()Description copied from class:LinuxOSProcessQueries the soft open file limit for the current process via nativegetrlimit.- Specified by:
queryRlimitSoftin classLinuxOSProcess- Returns:
- the soft limit value
-
queryRlimitHard
protected long queryRlimitHard()Description copied from class:LinuxOSProcessQueries the hard open file limit for the current process via nativegetrlimit.- Specified by:
queryRlimitHardin classLinuxOSProcess- Returns:
- the hard limit value
-