Class ProcessStatus

java.lang.Object
  extended by ProcessStatus

public class ProcessStatus
extends Object

Represents status (memory and CPU usage) information about a process.

Not all fields are available from the system directly, some fields are computed using other fields (e.g. in Linux swap is computed from difference of virtual and resident memory, exitTime is the same as timestamp, on Windows virtual memory includes swap usage which may contain redundancies). Peak information on some platforms (e.g. Linux) is updated as being sampled, so make sure the peaks are reset when a different process is sampled.

timestamp, startTime and exitTime are relative to OS-specific Epoch and should be used in relation to each other, hence no normalization is done here. A few Epoch interpretations:

Sometimes the information gathering may fail (e.g. process exits and information is no longer available), then the fields should remain untouched preserving last sample results from the last successful call.

See Also:
SystemManager.fetchProcessStatus(int, ProcessStatus)

Field Summary
 long exitTime
          Microseconds when this process exited since Epoch If the information is not available (process did not exit yet) then it contains the current timestamp.
 int pageFaultCount
          Number of (major) page faults.
 long residentPeak
          Maximum peak usage of resident memory (working set) in bytes.
 long residentSize
          Resident memory (working set) size in bytes.
 long systemTime
          CPU time spent on executing the process in kernel space in microseconds.
 long startTime
          Microseconds when this process started since Epoch.
 long swapPeak
          Maximum peak usage of swap space (memory on disk) in bytes.
 long swapSize
          Usage of swap space (memory on disk) in bytes.
 long timestamp
          Microseconds since Epoch until this information has been updated.
 long userTime
          CPU time spent on executing the process tasks in micro seconds.
 long virtualPeak
          Maximum peak virtual memory size in bytes.
 long virtualSize
          Virtual memory size in bytes.
 
Constructor Summary
ProcessStatus()
           
 
Method Summary
 String getMemory()
          Compose a user-friendly string representation about memory peaks.
 String getTimes()
          Compose a user-friendly string representation of timing information.
 void printInKB()
           
 void resetPeaks()
          Resets the peak status information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pageFaultCount

public int pageFaultCount
Number of (major) page faults. Page faults are triggered when some process memory has been swapped out to disk and the requested memory page is not in the physical memory anymore (consequently OS loads those pages back into memory).


virtualSize

public long virtualSize
Virtual memory size in bytes. This is a memory size lying in physical (resident) memory plus some memory in swap space.

See Also:
residentSize, swapSize

virtualPeak

public long virtualPeak
Maximum peak virtual memory size in bytes. The maximum virtual memory observed. The observation is OS-dependent: some OSes (e.g. Windows) maintain this information themselves, while on others (e.g. Linux) the information is sampled only during SystemManager.fetchProcessStatus calls, hence may be inacurate. On Unix more precise information can be extracted from processes that are started as children.

See Also:
virtualSize

residentSize

public long residentSize
Resident memory (working set) size in bytes. This is the size of physical memory that process occupies at the moment of sampling.


residentPeak

public long residentPeak
Maximum peak usage of resident memory (working set) in bytes.

See Also:
residentSize

swapSize

public long swapSize
Usage of swap space (memory on disk) in bytes. This memory may or may not be in operating memory, i.e. OS may have chosen to copy some memory pages to swap space but not yet released from physical memory (typical Windows behavior). As a consequence on some operating systems swap and resident memory sum may exceed virtual memory.

See Also:
virtualSize

swapPeak

public long swapPeak
Maximum peak usage of swap space (memory on disk) in bytes. The memory may or may not be in operating memory.

See Also:
swapSize

userTime

public long userTime
CPU time spent on executing the process tasks in micro seconds. (note: calculated from Windows API, which is in 100ns units) (note: Windows also provide creation and exit times, which could be used to calculate the time duration of process life).


systemTime

public long systemTime
CPU time spent on executing the process in kernel space in microseconds. (note: calculated from Windows API, which is in 100ns units)


timestamp

public long timestamp
Microseconds since Epoch until this information has been updated.


startTime

public long startTime
Microseconds when this process started since Epoch.


exitTime

public long exitTime
Microseconds when this process exited since Epoch If the information is not available (process did not exit yet) then it contains the current timestamp.

Constructor Detail

ProcessStatus

public ProcessStatus()
Method Detail

resetPeaks

public void resetPeaks()
Resets the peak status information. Use this method when sampling is switched over a different process.


printInKB

public void printInKB()

getTimes

public String getTimes()
Compose a user-friendly string representation of timing information.

Returns:
string representing timing status.
See Also:
getMemory()

getMemory

public String getMemory()
Compose a user-friendly string representation about memory peaks.

Returns:
string representing memory peaks.
See Also:
getTimes(), resetPeaks()


© 2007 Marius Mikucionis