Class FreeBsdOSProcess
- All Implemented Interfaces:
OSProcess
@ThreadSafe public class FreeBsdOSProcess extends AbstractOSProcess
-
Nested Class Summary
-
Constructor Summary
Constructors Constructor Description FreeBsdOSProcess(int pid, java.lang.String[] split)
-
Method Summary
Modifier and Type Method Description long
getAffinityMask()
Retrieves the process affinity mask for this process.int
getBitness()
Attempts to get the bitness (32 or 64) of the process.long
getBytesRead()
Getter for the fieldbytesRead
.long
getBytesWritten()
Getter for the fieldbytesWritten
.java.lang.String
getCommandLine()
Getter for the fieldcommandLine
.java.lang.String
getCurrentWorkingDirectory()
Getter for the fieldcurrentWorkingDirectory
.java.lang.String
getGroup()
Getter for the fieldgroup
.java.lang.String
getGroupID()
Getter for the fieldgroupID
.long
getKernelTime()
Getter for the fieldkernelTime
.long
getMajorFaults()
The number of major (hard) faults the process has made which have required loading a memory page from disk.long
getMinorFaults()
The number of minor (soft) faults the process has made which have not required loading a memory page from disk.java.lang.String
getName()
Getter for the fieldname
.long
getOpenFiles()
Sets 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.int
getParentProcessID()
Getter for the fieldparentProcessID
.java.lang.String
getPath()
Getter for the fieldpath
.int
getPriority()
Getter for the fieldpriority
.long
getResidentSetSize()
Getter for the fieldresidentSetSize
.long
getStartTime()
Getter for the fieldstartTime
.OSProcess.State
getState()
Getter for the fieldstate
.int
getThreadCount()
Getter for the fieldthreadCount
.java.util.List<OSThread>
getThreadDetails()
Retrieves the threads of the process and their details.long
getUpTime()
Getter for the fieldupTime
.java.lang.String
getUser()
Getter for the fielduser
.java.lang.String
getUserID()
Getter for the fielduserID
.long
getUserTime()
Getter for the fielduserTime
.long
getVirtualSize()
Getter for the fieldvirtualSize
.boolean
updateAttributes()
Attempts to updates process attributes.Methods inherited from class oshi.software.common.AbstractOSProcess
getProcessCpuLoadBetweenTicks, getProcessCpuLoadCumulative, getProcessID, toString
-
Constructor Details
-
FreeBsdOSProcess
public FreeBsdOSProcess(int pid, java.lang.String[] split)
-
-
Method Details
-
getName
public java.lang.String getName()Description copied from interface:OSProcess
Getter for the field
name
.- Returns:
- Returns the name of the process.
-
getPath
public java.lang.String getPath()Description copied from interface:OSProcess
Getter for the field
path
.- Returns:
- Returns the full path of the executing process.
-
getCommandLine
public java.lang.String getCommandLine()Description copied from interface:OSProcess
Getter for the field
commandLine
.- Returns:
- Returns the process command line. The format of this string is
platform-dependent and may require the end user to parse the result.
On Linux and macOS systems, the string is null-character-delimited, to permit the end user to parse the executable and arguments if desired. Further, the macOS variant may include environment variables which the end user may wish to exclude from display.
On Solaris, the string is truncated to 80 characters.
On Windows, by default, performs a single WMI query for this process, with some latency. If this method will be frequently called for multiple processes, see the configuration file to enable a batch query mode leveraging
Win32ProcessCached.getCommandLine(int, long)
to improve performance.
-
getCurrentWorkingDirectory
public java.lang.String getCurrentWorkingDirectory()Description copied from interface:OSProcess
Getter for the field
currentWorkingDirectory
.- Returns:
- Returns the process current working directory. On Windows, this value is only populated for the current process.
-
getUser
public java.lang.String getUser()Description copied from interface:OSProcess
Getter for the field
user
.- Returns:
- Returns the user name. On Windows systems, also returns the domain prepended to the username.
-
getUserID
public java.lang.String getUserID()Description copied from interface:OSProcess
Getter for the field
userID
.- Returns:
- Returns the userID. On Windows systems, returns the Security ID (SID)
-
getGroup
public java.lang.String getGroup()Description copied from interface:OSProcess
Getter for the field
group
.- Returns:
- Returns the group.
On Windows systems, populating this value for processes other than
the current user requires administrative privileges (and still may
fail for some system processes) and can incur significant latency.
When successful, returns a the default primary group with access to
this process, corresponding to the SID in
OSProcess.getGroupID()
.
-
getGroupID
public java.lang.String getGroupID()Description copied from interface:OSProcess
Getter for the field
groupID
.- Returns:
- Returns the groupID.
On Windows systems, populating this value for processes other than
the current user requires administrative privileges (and still may
fail for some system processes) and can incur significant latency.
When successful, returns the default primary group SID with access to
this process, corresponding to the name in
OSProcess.getGroup()
.
-
getState
Description copied from interface:OSProcess
Getter for the field
state
.- Returns:
- Returns the execution state of the process.
-
getParentProcessID
public int getParentProcessID()Description copied from interface:OSProcess
Getter for the field
parentProcessID
.- Returns:
- Returns the parentProcessID, if any; 0 otherwise.
-
getThreadCount
public int getThreadCount()Description copied from interface:OSProcess
Getter for the field
threadCount
.- Returns:
- Returns the number of threads in this process.
-
getPriority
public int getPriority()Description copied from interface:OSProcess
Getter for the field
priority
.- Returns:
- Returns the priority of this process. For Linux and Unix, priority is a value in the range -20 to 19 (20 on some systems). The default priority is 0; lower priorities cause more favorable scheduling. For Windows, priority values can range from 0 (lowest priority) to 31 (highest priority). macOS has 128 priority levels, ranging from 0 (lowest priority) to 127 (highest priority). They are divided into several major bands: 0 through 51 are the normal levels; the default priority is 31. 52 through 79 are the highest priority regular threads; 80 through 95 are for kernel mode threads; and 96 through 127 correspond to real-time threads, which are treated differently than other threads by the scheduler.
-
getVirtualSize
public long getVirtualSize()Description copied from interface:OSProcess
Getter for the field
virtualSize
.- Returns:
- Returns the Virtual Memory Size (VSZ). It includes all memory that the process can access, including memory that is swapped out and memory that is from shared libraries.
-
getResidentSetSize
public long getResidentSetSize()Description copied from interface:OSProcess
Getter for the field
residentSetSize
.- Returns:
- Returns the Resident Set Size (RSS). On Windows, returns the Private Working Set size. It is used to show how much memory is allocated to that process and is in RAM. It does not include memory that is swapped out. It does include memory from shared libraries as long as the pages from those libraries are actually in memory. It does include all stack and heap memory.
-
getKernelTime
public long getKernelTime()Description copied from interface:OSProcess
Getter for the field
kernelTime
.- Returns:
- Returns the number of milliseconds the process has executed in kernel/system mode.
-
getUserTime
public long getUserTime()Description copied from interface:OSProcess
Getter for the field
userTime
.- Returns:
- Returns the number of milliseconds the process has executed in user mode.
-
getUpTime
public long getUpTime()Description copied from interface:OSProcess
Getter for the field
upTime
.- Returns:
- Returns the number of milliseconds since the process started.
-
getStartTime
public long getStartTime()Description copied from interface:OSProcess
Getter for the field
startTime
.- Returns:
- Returns the start time of the process in number of milliseconds since January 1, 1970.
-
getBytesRead
public long getBytesRead()Description copied from interface:OSProcess
Getter for the field
bytesRead
.- Returns:
- Returns the number of bytes the process has read from disk.
-
getBytesWritten
public long getBytesWritten()Description copied from interface:OSProcess
Getter for the field
bytesWritten
.- Returns:
- Returns the number of bytes the process has written to disk.
-
getOpenFiles
public long getOpenFiles()Description copied from interface:OSProcess
Sets 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
-
getBitness
public int getBitness()Description copied from interface:OSProcess
Attempts to get the bitness (32 or 64) of the process.- Returns:
- The bitness, if able to be determined, 0 otherwise.
-
getAffinityMask
public long getAffinityMask()Description copied from interface:OSProcess
Retrieves 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.
-
getThreadDetails
Description copied from interface:OSProcess
Retrieves the threads of the process and their details.The amount of returned information is operating-system dependent and may incur some latency.
- Returns:
- a list of threads
-
getMinorFaults
public long getMinorFaults()Description copied from interface:OSProcess
The number of minor (soft) faults the process has made which have not required loading a memory page from disk. Sometimes called reclaims.Not available on Solaris. On Windows, this includes the total of major and minor faults.
- Specified by:
getMinorFaults
in interfaceOSProcess
- Overrides:
getMinorFaults
in classAbstractOSProcess
- Returns:
- minor page faults (reclaims).
-
getMajorFaults
public long getMajorFaults()Description copied from interface:OSProcess
The number of major (hard) faults the process has made which have required loading a memory page from disk.Not available on Solaris. 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()
.- Specified by:
getMajorFaults
in interfaceOSProcess
- Overrides:
getMajorFaults
in classAbstractOSProcess
- Returns:
- major page faults.
-
updateAttributes
public boolean updateAttributes()Description copied from interface:OSProcess
Attempts to updates process attributes. Returns false if the update fails, which will occur if the process no longer exists.- Returns:
true
if the update was successful, false if the update failed. In addition, on a failed update the process state will be changed toOSProcess.State.INVALID
.
-