Package org.apache.hadoop.yarn.util
Class WindowsBasedProcessTree
java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.yarn.util.ResourceCalculatorProcessTree
org.apache.hadoop.yarn.util.WindowsBasedProcessTree
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable
-
Field Summary
Fields inherited from class org.apache.hadoop.yarn.util.ResourceCalculatorProcessTree
UNAVAILABLE -
Constructor Summary
ConstructorsConstructorDescriptionCreate a monitor for a Windows process tree.WindowsBasedProcessTree(String pid, Clock pClock) Create a monitor for a Windows process tree. -
Method Summary
Modifier and TypeMethodDescriptionbooleanVerify that the tree process id is same as its process group id.floatGet the CPU usage by all the processes in the process-tree in Windows.longGet the CPU time in millisecond used by all the processes in the process-tree since the process-tree was createdGet a dump of the process-tree.longgetRssMemorySize(int olderThanAge) Get the resident set size (rss) memory used by all the processes in the process-tree that are older than the passed in age.longgetVirtualMemorySize(int olderThanAge) Get the virtual memory used by all the processes in the process-tree that are older than the passed in age.static booleanvoidUpdate the process-tree with latest state.Methods inherited from class org.apache.hadoop.yarn.util.ResourceCalculatorProcessTree
getResourceCalculatorProcessTree, getRssMemorySize, getVirtualMemorySize, initializeMethods inherited from class org.apache.hadoop.conf.Configured
getConf, setConf
-
Constructor Details
-
WindowsBasedProcessTree
Create a monitor for a Windows process tree.- Parameters:
pid- Identifier of the job object.
-
WindowsBasedProcessTree
Create a monitor for a Windows process tree.- Parameters:
pid- Identifier of the job object.pClock- Clock to keep track of time for CPU utilization.
-
-
Method Details
-
isAvailable
public static boolean isAvailable() -
updateProcessTree
public void updateProcessTree()Description copied from class:ResourceCalculatorProcessTreeUpdate 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.- Specified by:
updateProcessTreein classResourceCalculatorProcessTree
-
checkPidPgrpidForMatch
public boolean checkPidPgrpidForMatch()Description copied from class:ResourceCalculatorProcessTreeVerify that the tree process id is same as its process group id.- Specified by:
checkPidPgrpidForMatchin classResourceCalculatorProcessTree- Returns:
- true if the process id matches else return false.
-
getProcessTreeDump
Description copied from class:ResourceCalculatorProcessTreeGet a dump of the process-tree.- Specified by:
getProcessTreeDumpin classResourceCalculatorProcessTree- Returns:
- a string concatenating the dump of information of all the processes in the process-tree
-
getVirtualMemorySize
public long getVirtualMemorySize(int olderThanAge) Description copied from class:ResourceCalculatorProcessTreeGet the virtual memory used by all the processes in the process-tree that are older than the passed in age.- Overrides:
getVirtualMemorySizein classResourceCalculatorProcessTree- Parameters:
olderThanAge- processes above this age are included in the memory addition- Returns:
- virtual memory used by the process-tree in bytes for
processes older than the specified age,
ResourceCalculatorProcessTree.UNAVAILABLEif it cannot be calculated.
-
getRssMemorySize
public long getRssMemorySize(int olderThanAge) Description copied from class:ResourceCalculatorProcessTreeGet the resident set size (rss) memory used by all the processes in the process-tree that are older than the passed in age.- Overrides:
getRssMemorySizein classResourceCalculatorProcessTree- Parameters:
olderThanAge- processes above this age are included in the memory addition- Returns:
- rss memory used by the process-tree in bytes for
processes older than specified age,
ResourceCalculatorProcessTree.UNAVAILABLEif it cannot be calculated.
-
getCumulativeCpuTime
public long getCumulativeCpuTime()Description copied from class:ResourceCalculatorProcessTreeGet the CPU time in millisecond used by all the processes in the process-tree since the process-tree was created- Overrides:
getCumulativeCpuTimein classResourceCalculatorProcessTree- Returns:
- cumulative CPU time in millisecond since the process-tree
created,
ResourceCalculatorProcessTree.UNAVAILABLEif it cannot be calculated.
-
getCpuUsagePercent
public float getCpuUsagePercent()Get the CPU usage by all the processes in the process-tree in Windows. Note: UNAVAILABLE will be returned in case when CPU usage is not available. It is NOT advised to return any other error code.- Overrides:
getCpuUsagePercentin classResourceCalculatorProcessTree- Returns:
- percentage CPU usage since the process-tree was created,
ResourceCalculatorProcessTree.UNAVAILABLEif CPU usage cannot be calculated or not available.
-