org.apache.hadoop.yarn.util
Class ResourceCalculatorProcessTree

java.lang.Object
  extended by org.apache.hadoop.yarn.util.ResourceCalculatorProcessTree
Direct Known Subclasses:
ProcfsBasedProcessTree

public abstract class ResourceCalculatorProcessTree
extends Object

Interface class to obtain process resource usage


Constructor Summary
ResourceCalculatorProcessTree()
           
 
Method Summary
abstract  boolean checkPidPgrpidForMatch()
          Verify that the tree process id is same as its process group id.
abstract  long getCumulativeCpuTime()
          Get the CPU time in millisecond used by all the processes in the process-tree since the process-tree created
 long getCumulativeRssmem()
          Get the cumulative resident set size (rss) memory used by all the processes in the process-tree.
abstract  long getCumulativeRssmem(int olderThanAge)
          Get the cumulative resident set size (rss) memory used by all the processes in the process-tree that are older than the passed in age.
 long getCumulativeVmem()
          Get the cumulative virtual memory used by all the processes in the process-tree.
abstract  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.
abstract  ResourceCalculatorProcessTree getProcessTree()
          Get the process-tree with latest state.
abstract  String getProcessTreeDump()
          Get a dump of the process-tree.
static ResourceCalculatorProcessTree getResourceCalculatorProcessTree(String pid, Class<? extends ResourceCalculatorProcessTree> clazz, org.apache.hadoop.conf.Configuration conf)
          Create the ResourceCalculatorProcessTree rooted to specified process from the class name and configure it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceCalculatorProcessTree

public ResourceCalculatorProcessTree()
Method Detail

getProcessTree

public abstract ResourceCalculatorProcessTree getProcessTree()
Get the process-tree with latest state. If the root-process is not alive, an empty tree will be returned. Each call to this function should increment the age of the running processes that already exist in the process tree. Age is used other API's of the interface.

Returns:
the process-tree with latest state.

getProcessTreeDump

public abstract 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.

getCumulativeRssmem

public long getCumulativeRssmem()
Get the cumulative resident set size (rss) memory used by all the processes in the process-tree.

Returns:
cumulative rss memory used by the process-tree in bytes. return 0 if it cannot be calculated

getCumulativeVmem

public abstract 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.

getCumulativeRssmem

public abstract long getCumulativeRssmem(int olderThanAge)
Get the cumulative resident set size (rss) 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 rss memory used by the process-tree in bytes, for processes older than this age. return 0 if it cannot be calculated

getCumulativeCpuTime

public abstract long getCumulativeCpuTime()
Get the CPU time in millisecond used by all the processes in the process-tree since the process-tree created

Returns:
cumulative CPU time in millisecond since the process-tree created return 0 if it cannot be calculated

checkPidPgrpidForMatch

public abstract boolean checkPidPgrpidForMatch()
Verify that the tree process id is same as its process group id.

Returns:
true if the process id matches else return false.

getResourceCalculatorProcessTree

public static ResourceCalculatorProcessTree getResourceCalculatorProcessTree(String pid,
                                                                             Class<? extends ResourceCalculatorProcessTree> clazz,
                                                                             org.apache.hadoop.conf.Configuration conf)
Create the ResourceCalculatorProcessTree rooted to specified process from the class name and configure it. If class name is null, this method will try and return a process tree plugin available for this system.

Parameters:
pid - process pid of the root of the process tree
clazz - class-name
conf - configure the plugin with this.
Returns:
ResourceCalculatorProcessTree or null if ResourceCalculatorPluginTree is not available for this system.


Copyright © 2012 Apache Software Foundation. All Rights Reserved.