public class OSProcess extends Object implements Serializable
| Modifier and Type | Class and Description |
|---|---|
static class |
OSProcess.State
Process Execution States
|
| Constructor and Description |
|---|
OSProcess() |
| Modifier and Type | Method and Description |
|---|---|
double |
calculateCpuPercent()
Calculates CPU usage of this process.
|
int |
getBitness()
Attempts to get the bitness (32 or 64) of the process.
|
long |
getBytesRead()
Getter for the field
bytesRead. |
long |
getBytesWritten()
Getter for the field
bytesWritten. |
String |
getCommandLine()
Getter for the field
commandLine. |
String |
getCurrentWorkingDirectory()
Getter for the field
currentWorkingDirectory. |
String |
getGroup()
Getter for the field
group. |
String |
getGroupID()
Getter for the field
groupID. |
long |
getKernelTime()
Getter for the field
kernelTime. |
String |
getName()
Getter for the field
name. |
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 field
parentProcessID. |
String |
getPath()
Getter for the field
path. |
int |
getPriority()
Getter for the field
priority. |
int |
getProcessID()
Getter for the field
processID. |
long |
getResidentSetSize()
Getter for the field
residentSetSize. |
long |
getStartTime()
Getter for the field
startTime. |
OSProcess.State |
getState()
Getter for the field
state. |
int |
getThreadCount()
Getter for the field
threadCount. |
long |
getUpTime()
Getter for the field
upTime. |
String |
getUser()
Getter for the field
user. |
String |
getUserID()
Getter for the field
userID. |
long |
getUserTime()
Getter for the field
userTime. |
long |
getVirtualSize()
Getter for the field
virtualSize. |
void |
setBitness(int bitness)
Setter for the field
bitness. |
void |
setBytesRead(long bytesRead)
Set the number of bytes the process has read from disk.
|
void |
setBytesWritten(long bytesWritten)
Set the number of bytes the process has written to disk.
|
void |
setCommandLine(String commandLine)
Sets the process command line.
|
void |
setCurrentWorkingDirectory(String currentWorkingDirectory)
Sets the process current working directory
|
void |
setGroup(String group)
Sets the group.
|
void |
setGroupID(String groupID)
Sets the Group ID.
|
void |
setKernelTime(long kernelTime)
Set the number of milliseconds the process has executed in kernel mode.
|
void |
setName(String name)
Set the name of the process.
|
void |
setOpenFiles(long count)
Sets the number of open file handles (or network connections) that belongs to
the process
|
void |
setParentProcessID(int parentProcessID)
Set the parentProcessID.
|
void |
setPath(String path)
Set the full path of the executing process.
|
void |
setPriority(int priority)
Set the priority of this process.
|
void |
setProcessID(int processID)
Set the processID.
|
void |
setResidentSetSize(long residentSetSize)
Set the Resident Set Size (RSS).
|
void |
setStartTime(long startTime)
Set the start time of the process in number of milliseconds since January 1,
1970.
|
void |
setState(OSProcess.State state)
Set the execution state of the process.
|
void |
setThreadCount(int threadCount)
Set the number of threads in this process.
|
void |
setUpTime(long upTime)
Set the number of milliseconds since the process started.
|
void |
setUser(String user)
Sets the user.
|
void |
setUserID(String userID)
Sets the User ID.
|
void |
setUserTime(long userTime)
Set the number of milliseconds the process has executed in user mode.
|
void |
setVirtualSize(long virtualSize)
Set the Virtual Memory Size (VSZ).
|
String |
toString() |
public String getName()
Getter for the field name.
public String getPath()
Getter for the field path.
public String getCommandLine()
Getter for the field commandLine.
public String getCurrentWorkingDirectory()
Getter for the field currentWorkingDirectory.
public String getUser()
Getter for the field user.
public String getUserID()
Getter for the field userID.
public String getGroup()
Getter for the field group.
OperatingSystem.getProcess(int). When
successful, returns a comma-delimited list of groups with access to
this process, corresponding to the SIDs in getGroupID().public String getGroupID()
Getter for the field groupID.
OperatingSystem.getProcess(int). When
successful, returns a comma-delimited list of group SIDs with access
to this process, corresponding to the names in getGroup().public OSProcess.State getState()
Getter for the field state.
public int getProcessID()
Getter for the field processID.
public int getParentProcessID()
Getter for the field parentProcessID.
public int getThreadCount()
Getter for the field threadCount.
public int getPriority()
Getter for the field priority.
public long getVirtualSize()
Getter for the field virtualSize.
public long getResidentSetSize()
Getter for the field residentSetSize.
public long getKernelTime()
Getter for the field kernelTime.
public long getUserTime()
Getter for the field userTime.
public long getUpTime()
Getter for the field upTime.
public long getStartTime()
Getter for the field startTime.
public long getBytesRead()
Getter for the field bytesRead.
public long getBytesWritten()
Getter for the field bytesWritten.
public void setName(String name)
name - process namepublic void setPath(String path)
path - process pathpublic void setCommandLine(String commandLine)
commandLine - The commandLine to set.public void setCurrentWorkingDirectory(String currentWorkingDirectory)
currentWorkingDirectory - The currentWorkingDirectory to set.public void setUser(String user)
user - The user to set.public void setUserID(String userID)
userID - The userID to set.public void setGroup(String group)
group - The group to set.public void setGroupID(String groupID)
groupID - The groupID to set.public void setState(OSProcess.State state)
state - execution statepublic void setProcessID(int processID)
processID - process IDpublic void setParentProcessID(int parentProcessID)
parentProcessID - parent process IDpublic void setThreadCount(int threadCount)
threadCount - number of threadspublic void setPriority(int priority)
priority - prioritypublic void setVirtualSize(long virtualSize)
virtualSize - virtual sizepublic void setResidentSetSize(long residentSetSize)
residentSetSize - resident set sizepublic void setKernelTime(long kernelTime)
kernelTime - kernel timepublic void setUserTime(long userTime)
userTime - user timepublic void setStartTime(long startTime)
startTime - start timepublic void setUpTime(long upTime)
upTime - up timepublic void setBytesRead(long bytesRead)
bytesRead - number of bytes readpublic void setBytesWritten(long bytesWritten)
bytesWritten - number of bytes writtenpublic void setOpenFiles(long count)
count - The number of handlespublic long getOpenFiles()
public double calculateCpuPercent()
public int getBitness()
public void setBitness(int bitness)
Setter for the field bitness.
bitness - The bitness to set.Copyright © 2010–2019 oshi. All rights reserved.