org.apache.hadoop.yarn.util
Class ResourceCalculatorPlugin

java.lang.Object
  extended by org.apache.hadoop.conf.Configured
      extended by org.apache.hadoop.yarn.util.ResourceCalculatorPlugin
All Implemented Interfaces:
org.apache.hadoop.conf.Configurable
Direct Known Subclasses:
LinuxResourceCalculatorPlugin, WindowsResourceCalculatorPlugin

@InterfaceAudience.LimitedPrivate(value={"YARN","MAPREDUCE"})
@InterfaceStability.Unstable
public abstract class ResourceCalculatorPlugin
extends org.apache.hadoop.conf.Configured

Plugin to calculate resource information on the system.


Field Summary
protected  String processPid
           
 
Constructor Summary
ResourceCalculatorPlugin()
           
 
Method Summary
abstract  long getAvailablePhysicalMemorySize()
          Obtain the total size of the available physical memory present in the system.
abstract  long getAvailableVirtualMemorySize()
          Obtain the total size of the available virtual memory present in the system.
abstract  long getCpuFrequency()
          Obtain the CPU frequency of on the system.
abstract  float getCpuUsage()
          Obtain the CPU usage % of the machine.
abstract  long getCumulativeCpuTime()
          Obtain the cumulative CPU time since the system is on.
abstract  int getNumProcessors()
          Obtain the total number of processors present on the system.
abstract  long getPhysicalMemorySize()
          Obtain the total size of the physical memory present in the system.
static ResourceCalculatorPlugin getResourceCalculatorPlugin(Class<? extends ResourceCalculatorPlugin> clazz, org.apache.hadoop.conf.Configuration conf)
          Create the ResourceCalculatorPlugin from the class name and configure it.
abstract  long getVirtualMemorySize()
          Obtain the total size of the virtual memory present in the system.
 void setProcessPid(String pid)
          set the pid of the process for which getProcResourceValues will be invoked
 
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
 

Field Detail

processPid

protected String processPid
Constructor Detail

ResourceCalculatorPlugin

public ResourceCalculatorPlugin()
Method Detail

setProcessPid

public void setProcessPid(String pid)
set the pid of the process for which getProcResourceValues will be invoked

Parameters:
pid -

getVirtualMemorySize

public abstract long getVirtualMemorySize()
Obtain the total size of the virtual memory present in the system.

Returns:
virtual memory size in bytes.

getPhysicalMemorySize

public abstract long getPhysicalMemorySize()
Obtain the total size of the physical memory present in the system.

Returns:
physical memory size bytes.

getAvailableVirtualMemorySize

public abstract long getAvailableVirtualMemorySize()
Obtain the total size of the available virtual memory present in the system.

Returns:
available virtual memory size in bytes.

getAvailablePhysicalMemorySize

public abstract long getAvailablePhysicalMemorySize()
Obtain the total size of the available physical memory present in the system.

Returns:
available physical memory size bytes.

getNumProcessors

public abstract int getNumProcessors()
Obtain the total number of processors present on the system.

Returns:
number of processors

getCpuFrequency

public abstract long getCpuFrequency()
Obtain the CPU frequency of on the system.

Returns:
CPU frequency in kHz

getCumulativeCpuTime

public abstract long getCumulativeCpuTime()
Obtain the cumulative CPU time since the system is on.

Returns:
cumulative CPU time in milliseconds

getCpuUsage

public abstract float getCpuUsage()
Obtain the CPU usage % of the machine. Return -1 if it is unavailable

Returns:
CPU usage in %

getResourceCalculatorPlugin

public static ResourceCalculatorPlugin getResourceCalculatorPlugin(Class<? extends ResourceCalculatorPlugin> clazz,
                                                                   org.apache.hadoop.conf.Configuration conf)
Create the ResourceCalculatorPlugin from the class name and configure it. If class name is null, this method will try and return a memory calculator plugin available for this system.

Parameters:
clazz - ResourceCalculator plugin class-name
conf - configure the plugin with this.
Returns:
ResourceCalculatorPlugin or null if ResourceCalculatorPlugin is not available for current system


Copyright © 2014 Apache Software Foundation. All Rights Reserved.