com.jezhumble.javasysmon
Class ProcessInfo

java.lang.Object
  extended by com.jezhumble.javasysmon.ProcessInfo

public class ProcessInfo
extends java.lang.Object

This object represents JavaSysMon's understanding of a process. You can get all the information JavaSysMon knows about a particular process from this object.

There are also convenience methods that can be used to print out a process table in a monospace font (for example, on the console).


Constructor Summary
ProcessInfo(int pid, int parentPid, java.lang.String command, java.lang.String name, java.lang.String owner, long userMillis, long systemMillis, long residentBytes, long totalBytes)
           
 
Method Summary
 java.lang.String getCommand()
          The command that was originally used to start this process.
 java.lang.String getName()
          The name of this process.
 java.lang.String getOwner()
          The name of the owner of this process.
 int getParentPid()
          The id of the parent process of this parent
 int getPid()
          The id of this process
 long getResidentBytes()
          The number of bytes used by this process that are currently in physical memory.
 long getSystemMillis()
          The number of milliseconds that this process has been running on the CPUs in kernel mode.
 long getTotalBytes()
          The total size of this process in bytes.
 long getUserMillis()
          The number of milliseconds that this process has been running on the CPUs in user mode.
static java.lang.String header()
          Prints out a header that can be used along with toString() (assuming you use a monospace font).
 java.lang.String toString()
          A one-line string representation of some of the information in this object that can be used to print out a single line in a process table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProcessInfo

public ProcessInfo(int pid,
                   int parentPid,
                   java.lang.String command,
                   java.lang.String name,
                   java.lang.String owner,
                   long userMillis,
                   long systemMillis,
                   long residentBytes,
                   long totalBytes)
Method Detail

getPid

public int getPid()
The id of this process

Returns:
The id of this process

getParentPid

public int getParentPid()
The id of the parent process of this parent

Returns:
The id of the parent process of this parent

getCommand

public java.lang.String getCommand()
The command that was originally used to start this process. Not currently available on Mac OSX or Solaris (the C source contains some information on how to get this data for anyone interested in implementing it)

Returns:
A string representing the command that was originally used to start this process.

getName

public java.lang.String getName()
The name of this process. This is for display purposes only.

Returns:
The name of this process.

getOwner

public java.lang.String getOwner()
The name of the owner of this process. This is derived from the uid, not the effective id. On Windows, this is in the format DOMAIN\USERNAME

Returns:
The name of the owner of this process.

getUserMillis

public long getUserMillis()
The number of milliseconds that this process has been running on the CPUs in user mode. Note that this is not "wall time". On Mac OSX this information is only available for the current process.

Returns:
The number of milliseconds that this process has been running on the CPUs in user mode.

getSystemMillis

public long getSystemMillis()
The number of milliseconds that this process has been running on the CPUs in kernel mode. Note that this is not "wall time". On Mac OSX this information is only available for the current process.

Returns:
The number of milliseconds that this process has been running on the CPUs in kernel mode.

getResidentBytes

public long getResidentBytes()
The number of bytes used by this process that are currently in physical memory. On Mac OSX this information is only available for the current process.

Returns:
The number of bytes used by this process that are currently in physical memory.

getTotalBytes

public long getTotalBytes()
The total size of this process in bytes. On Mac OSX this information is only available for the current process.

Returns:
The total number of bytes used by this process.

header

public static java.lang.String header()
Prints out a header that can be used along with toString() (assuming you use a monospace font).

Returns:
A header that can be used when printing out the process table.

toString

public java.lang.String toString()
A one-line string representation of some of the information in this object that can be used to print out a single line in a process table. Fields have a fixed length so that the table looks nice in a monospace font.

Overrides:
toString in class java.lang.Object
Returns:
a single line representing some of the information about this process.


Copyright © 2009 ThoughtWorks. All Rights Reserved.