Class NetBsdOSProcess
- All Implemented Interfaces:
OSProcess
-
Nested Class Summary
Nested classes/interfaces inherited from interface OSProcess
OSProcess.StateModifier and TypeInterfaceDescriptionstatic enumProcess and Thread Execution States -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final List<BsdPsKeyword> Orderedpscolumns queried for each process.Fields inherited from class BsdOSProcess
commandLineBackup, group, groupID, involuntaryContextSwitches, majorFaults, minorFaults, residentSetSize, user, userID, voluntaryContextSwitchesFields 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
ConstructorsConstructorDescriptionNetBsdOSProcess(int pid, Map<BsdPsKeyword, String> psMap, NetBsdOperatingSystem os) -
Method Summary
Modifier and TypeMethodDescriptionlongGets the process affinity mask for this process.Makes a best effort attempt to obtain the current working directory for the process.longGets the hard limit for open file handles (or network connections) that belong to the given process.longGets the number of open file handles (or network connections) that belongs to the process.longGets the soft limit for open file handles (or network connections) of the given process.Retrieves the threads of the process and their details.protected StringReturns the comma-separatedps -ocolumn list for this platform, derived fromBsdOSProcess.psKeywords().protected List<BsdPsKeyword> Returns this platform's orderedpscolumn keys, used both to build thepscommand and to parse its output positionally.Queries this process's argument list.protected intQueries this process's bitness (32 or 64), or0if unknown.Queries this process's environment variables.protected voidMethods inherited from class BsdOSProcess
getArguments, getBitness, getCommandLine, getEnvironmentVariables, getGroup, getGroupID, getInvoluntaryContextSwitches, getMajorFaults, getMinorFaults, getProcessOpenFileLimit, getResidentMemory, getStateFromOutput, getUser, getUserID, getVoluntaryContextSwitches, queryStartTimeMillis, updateAttributes, updateAttributesModifier and TypeMethodDescriptionMakes 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 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.protected static longgetProcessOpenFileLimit(long processId, int index) Parses the soft or hard open-file limit for another process from/proc/<pid>/limits.longReturns the total amount of physical memory (RAM) currently mapped to the process's address space.protected static OSProcess.StategetStateFromOutput(char stateValue) Maps apssingle-character state to anOSProcess.State.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 longReturns this process's start time in epoch milliseconds, or-1to derive it from thepselapsed-time column.booleanAttempts to update process attributes.protected booleanupdateAttributes(Map<BsdPsKeyword, String> psMap) Populates this process's attributes from a parsedpsrow.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, getPrivateResidentMemoryModifier 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.default longReturns an estimate of the portion of physical memory (RAM) uniquely attributed to this process.
-
Field Details
-
PS_KEYWORDS
Orderedpscolumns queried for each process. Shared by NetBsdOSProcess and the NetBSD OperatingSystem so the column list and parsing stay in lockstep.ARGSmust remain last. -
PS_COMMAND_ARGS
-
-
Constructor Details
-
NetBsdOSProcess
-
-
Method Details
-
psKeywords
Description copied from class:BsdOSProcessReturns this platform's orderedpscolumn keys, used both to build thepscommand and to parse its output positionally.- Specified by:
psKeywordsin classBsdOSProcess- Returns:
- the ordered column keys
-
psCommandArgs
Description copied from class:BsdOSProcessReturns the comma-separatedps -ocolumn list for this platform, derived fromBsdOSProcess.psKeywords().- Specified by:
psCommandArgsin classBsdOSProcess- Returns:
- the
pscolumn argument
-
queryArguments
Description copied from class:BsdOSProcessQueries this process's argument list.- Specified by:
queryArgumentsin classBsdOSProcess- Returns:
- the arguments, or an empty list if unavailable
-
queryEnvironmentVariables
Description copied from class:BsdOSProcessQueries this process's environment variables.- Specified by:
queryEnvironmentVariablesin classBsdOSProcess- Returns:
- the environment map, or an empty map if unavailable
-
getCurrentWorkingDirectory
-
getOpenFiles
public long getOpenFiles()Description copied from interface:OSProcessGets the number of open file handles (or network connections) that belongs to the process.On FreeBSD and Solaris, this value is only populated if information for a single process id is requested.
- Returns:
- open files or -1 if unknown or not supported
-
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.
-
queryBitness
protected int queryBitness()Description copied from class:BsdOSProcessQueries this process's bitness (32 or 64), or0if unknown.- Specified by:
queryBitnessin classBsdOSProcess- Returns:
- the bitness
-
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.
- Specified by:
getAffinityMaskin interfaceOSProcess- Overrides:
getAffinityMaskin classBsdOSProcess- Returns:
- a bit vector in which each bit represents the processors that a process is allowed to run on.
-
getThreadDetails
-
updateThreadCount
protected void updateThreadCount()Description copied from class:BsdOSProcessPopulatesAbstractOSProcess.threadCountfor platforms whosepsoutput lacks annlwpcolumn. The default is a no-op (the count is taken from thenlwpcolumn); OpenBSD and NetBSD override this with a separatepsquery.- Overrides:
updateThreadCountin classBsdOSProcess
-