org.apache.hadoop.yarn.util
Class ResourceCalculatorProcessTree

java.lang.Object
  extended by org.apache.hadoop.conf.Configured
      extended by org.apache.hadoop.yarn.util.ResourceCalculatorProcessTree
All Implemented Interfaces:
org.apache.hadoop.conf.Configurable
Direct Known Subclasses:
ProcfsBasedProcessTree, WindowsBasedProcessTree

@InterfaceAudience.Private
public abstract class ResourceCalculatorProcessTree
extends org.apache.hadoop.conf.Configured

Interface class to obtain process resource usage


Constructor Summary
ResourceCalculatorProcessTree(String root)
          Create process-tree instance with specified root process.
 
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  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.
abstract  void updateProcessTree()
          Update the process-tree with latest state.
 
Methods inherited from class org.apache.hadoop.conf.Configured
getConf, setConf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceCalculatorProcessTree

public ResourceCalculatorProcessTree(String root)
Create process-tree instance with specified root process. Subclass must override this.

Parameters:
root - process-tree root-process
Method Detail

updateProcessTree

public abstract void updateProcessTree()
Update the process-tree with latest state. 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.


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 © 2014 Apache Software Foundation. All Rights Reserved.