org.apache.hadoop.util
Class ProcfsBasedProcessTree

java.lang.Object
  extended by org.apache.hadoop.util.ProcessTree
      extended by org.apache.hadoop.util.ProcfsBasedProcessTree

public class ProcfsBasedProcessTree
extends ProcessTree

A Proc file-system based ProcessTree. Works only on Linux.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hadoop.util.ProcessTree
ProcessTree.Signal
 
Field Summary
 
Fields inherited from class org.apache.hadoop.util.ProcessTree
isSetsidAvailable
 
Constructor Summary
ProcfsBasedProcessTree(String pid)
           
ProcfsBasedProcessTree(String pid, boolean setsidUsed)
           
ProcfsBasedProcessTree(String pid, String procfsDir)
           
 
Method Summary
 long getCumulativeVmem()
          Get the cumulative virtual memory used by all the processes in the process-tree.
 long getCumulativeVmem(int olderThanAge)
          Get the cumulative virtual memory used by all the processes in the process-tree that are older than the passed in age.
 ProcfsBasedProcessTree getProcessTree()
          Get the process-tree with latest state.
 String getProcessTreeDump()
          Get a dump of the process-tree.
 boolean isAlive()
          Is the root-process alive?
 boolean isAnyProcessInTreeAlive()
          Is any of the subprocesses in the process-tree alive?
static boolean isAvailable()
          Checks if the ProcfsBasedProcessTree is available on this system.
 String toString()
          Returns a string printing PIDs of process present in the ProcfsBasedProcessTree.
 
Methods inherited from class org.apache.hadoop.util.ProcessTree
isAlive, isProcessGroupAlive, killProcess, killProcessGroup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProcfsBasedProcessTree

public ProcfsBasedProcessTree(String pid)

ProcfsBasedProcessTree

public ProcfsBasedProcessTree(String pid,
                              boolean setsidUsed)

ProcfsBasedProcessTree

public ProcfsBasedProcessTree(String pid,
                              String procfsDir)
Method Detail

isAvailable

public static boolean isAvailable()
Checks if the ProcfsBasedProcessTree is available on this system.

Returns:
true if ProcfsBasedProcessTree is available. False otherwise.

getProcessTree

public ProcfsBasedProcessTree getProcessTree()
Get the process-tree with latest state. If the root-process is not alive, an empty tree will be returned.

Returns:
the process-tree with latest state.

isAlive

public boolean isAlive()
Is the root-process alive?

Returns:
true if the root-process is alive, false otherwise.

isAnyProcessInTreeAlive

public boolean isAnyProcessInTreeAlive()
Is any of the subprocesses in the process-tree alive?

Returns:
true if any of the processes in the process-tree is alive, false otherwise.

getProcessTreeDump

public String getProcessTreeDump()
Get a dump of the process-tree.

Returns:
a string concatenating the dump of information of all the processes in the process-tree

getCumulativeVmem

public long getCumulativeVmem()
Get the cumulative virtual memory used by all the processes in the process-tree.

Returns:
cumulative virtual memory used by the process-tree in bytes.

getCumulativeVmem

public long getCumulativeVmem(int olderThanAge)
Get the cumulative virtual memory used by all the processes in the process-tree that are older than the passed in age.

Parameters:
olderThanAge - processes above this age are included in the memory addition
Returns:
cumulative virtual memory used by the process-tree in bytes, for processes older than this age.

toString

public String toString()
Returns a string printing PIDs of process present in the ProcfsBasedProcessTree. Output format : [pid pid ..]

Overrides:
toString in class Object


Copyright © 2009 The Apache Software Foundation