Class MacOSProcessJNA
java.lang.Object
oshi.software.common.AbstractOSProcess
oshi.software.common.os.mac.MacOSProcess
oshi.software.os.mac.MacOSProcessJNA
- All Implemented Interfaces:
OSProcess
JNA-backed macOS OSProcess.
-
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 MacOSProcess
bitness, contextSwitches, currentWorkingDirectory, group, groupID, involuntaryContextSwitches, LOG_MAC_SYSCTL_WARNING, MAC_RLIMIT_NOFILE, majorFaults, majorVersion, memoryFootprint, minorFaults, minorVersion, openFiles, os, P_LP64, residentSetSize, user, userID, voluntaryContextSwitchesModifier and TypeFieldDescriptionprotected intprotected longprotected Stringprotected Stringprotected Stringprotected longprotected static final booleanprotected static final intprotected longprotected final intprotected longprotected longprotected final intprotected longprotected final MacOperatingSystemprotected static final intprotected longprotected Stringprotected Stringprotected longFields 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 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.Queries this process's arguments and environment via the backend-specificKERN_PROCARGS2sysctl.protected intReturns the number of logical processors via the backend-specifichw.logicalcpusysctl.booleanAttempts to update process attributes.Methods inherited from class MacOSProcess
getAffinityMask, getArguments, getBitness, getCommandLine, getContextSwitches, getCurrentWorkingDirectory, getEnvironmentVariables, getGroup, getGroupID, getInvoluntaryContextSwitches, getMajorFaults, getMinorFaults, getOpenFiles, getPrivateResidentMemory, getResidentMemory, getThreadDetails, getUser, getUserID, getVoluntaryContextSwitches, stateFromStatusModifier and TypeMethodDescriptionlongGets the process affinity mask for 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.longA snapshot of the context switches the process has done, equal to the sum ofOSProcess.getVoluntaryContextSwitches()andOSProcess.getInvoluntaryContextSwitches()on platforms that provide the split.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.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.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.longThe number of voluntary context switches the process has made.protected static OSProcess.StatestateFromStatus(int status) Maps a macOSpbi_statusvalue to anOSProcess.State.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()
-
Constructor Details
-
MacOSProcessJNA
-
-
Method Details
-
queryArgsAndEnvironment
Description copied from class:MacOSProcessQueries this process's arguments and environment via the backend-specificKERN_PROCARGS2sysctl.- Specified by:
queryArgsAndEnvironmentin classMacOSProcess- Returns:
- a pair of the argument list and the environment map
-
queryLogicalProcessorCount
protected int queryLogicalProcessorCount()Description copied from class:MacOSProcessReturns the number of logical processors via the backend-specifichw.logicalcpusysctl.- Specified by:
queryLogicalProcessorCountin classMacOSProcess- Returns:
- the logical processor count
-
getSoftOpenFileLimit
public long getSoftOpenFileLimit()Description copied from interface:OSProcessGets the soft limit for open file handles (or network connections) of the given process.Retrieving the soft limit for processes other than the calling process is only supported on Linux, FreeBsd and Solaris.
- Returns:
- the soft open file limit for the process if available. Returns -1 if the calling process is not the same as this OSProcess instance and the underlying operating system does not support retrieving the soft limit for other processes.
-
getHardOpenFileLimit
public long getHardOpenFileLimit()Description copied from interface:OSProcessGets the hard limit for open file handles (or network connections) that belong to the given process.Retrieving the hard limit for processes other than the calling process is only supported on Linux, FreeBsd and Solaris.
- Returns:
- the hard open file limit for the process if available. Returns -1 if the calling process is not the same as this OSProcess instance and the underlying operating system does not support retrieving the hard limit for other processes.
-
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.
-