@InterfaceAudience.Private @InterfaceStability.Unstable public class ProcfsBasedProcessTree extends ResourceCalculatorProcessTree
Modifier and Type | Field and Description |
---|---|
static long |
JIFFY_LENGTH_IN_MILLIS |
static int |
KB_TO_BYTES |
static long |
PAGE_SIZE |
protected Map<String,org.apache.hadoop.yarn.util.ProcfsBasedProcessTree.ProcessTreeSmapMemInfo> |
processSMAPTree |
protected Map<String,org.apache.hadoop.yarn.util.ProcfsBasedProcessTree.ProcessInfo> |
processTree |
static String |
PROCFS_CMDLINE_FILE |
static String |
PROCFS_STAT_FILE |
static String |
SMAPS |
UNAVAILABLE
Constructor and Description |
---|
ProcfsBasedProcessTree(String pid) |
ProcfsBasedProcessTree(String pid,
String procfsDir) |
ProcfsBasedProcessTree(String pid,
String procfsDir,
Clock clock)
Build a new process tree rooted at the pid.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkPidPgrpidForMatch()
Verify that the given process id is same as its process group id.
|
static boolean |
checkPidPgrpidForMatch(String _pid,
String procfs) |
boolean |
contains(String pid)
Returns boolean indicating whether pid
is in process tree.
|
float |
getCpuUsagePercent()
Get the CPU usage by all the processes in the process-tree in Unix.
|
long |
getCumulativeCpuTime()
Get the CPU time in millisecond used by all the processes in the
process-tree since the process-tree was created
|
List<String> |
getCurrentProcessIDs() |
String |
getProcessTreeDump()
Get a dump of the process-tree.
|
long |
getRssMemorySize(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.
|
long |
getVirtualMemorySize(int olderThanAge)
Get the virtual memory used by all the processes in the
process-tree that are older than the passed in age.
|
static boolean |
isAvailable()
Checks if the ProcfsBasedProcessTree is available on this system.
|
static void |
main(String[] args)
Test the
ProcfsBasedProcessTree |
void |
setConf(org.apache.hadoop.conf.Configuration conf) |
String |
toString()
Returns a string printing PIDs of process present in the
ProcfsBasedProcessTree.
|
void |
updateProcessTree()
Update process-tree with latest state.
|
getResourceCalculatorProcessTree, getRssMemorySize, getVirtualMemorySize, initialize
public static final String PROCFS_STAT_FILE
public static final String PROCFS_CMDLINE_FILE
public static final long PAGE_SIZE
public static final long JIFFY_LENGTH_IN_MILLIS
public static final String SMAPS
public static final int KB_TO_BYTES
protected Map<String,org.apache.hadoop.yarn.util.ProcfsBasedProcessTree.ProcessTreeSmapMemInfo> processSMAPTree
public ProcfsBasedProcessTree(String pid)
public ProcfsBasedProcessTree(String pid, String procfsDir, Clock clock)
pid
- root of the process treeprocfsDir
- the root of a proc file system - only used for testing.clock
- clock for controlling time for testingpublic void setConf(org.apache.hadoop.conf.Configuration conf)
setConf
in interface org.apache.hadoop.conf.Configurable
setConf
in class org.apache.hadoop.conf.Configured
public static boolean isAvailable()
public void updateProcessTree()
updateProcessTree
in class ResourceCalculatorProcessTree
public boolean checkPidPgrpidForMatch()
checkPidPgrpidForMatch
in class ResourceCalculatorProcessTree
public String getProcessTreeDump()
getProcessTreeDump
in class ResourceCalculatorProcessTree
public long getVirtualMemorySize(int olderThanAge)
ResourceCalculatorProcessTree
getVirtualMemorySize
in class ResourceCalculatorProcessTree
olderThanAge
- processes above this age are included in the
memory additionResourceCalculatorProcessTree.UNAVAILABLE
if it
cannot be calculated.public long getRssMemorySize(int olderThanAge)
ResourceCalculatorProcessTree
getRssMemorySize
in class ResourceCalculatorProcessTree
olderThanAge
- processes above this age are included in the
memory additionResourceCalculatorProcessTree.UNAVAILABLE
if it cannot be
calculated.public long getCumulativeCpuTime()
ResourceCalculatorProcessTree
getCumulativeCpuTime
in class ResourceCalculatorProcessTree
ResourceCalculatorProcessTree.UNAVAILABLE
if it cannot be calculated.public float getCpuUsagePercent()
getCpuUsagePercent
in class ResourceCalculatorProcessTree
ResourceCalculatorProcessTree.UNAVAILABLE
if CPU usage cannot be calculated or not available.public String toString()
public boolean contains(String pid)
public static void main(String[] args)
ProcfsBasedProcessTree
args
- Copyright © 2008–2019 Apache Software Foundation. All rights reserved.