public class ProcfsBasedProcessTree extends ProcessTree
ProcessTree.Signal
Modifier and Type | Field and Description |
---|---|
static long |
JIFFY_LENGTH_IN_MILLIS |
static long |
PAGE_SIZE |
DEFAULT_SLEEPTIME_BEFORE_SIGKILL, isSetsidAvailable
Constructor and Description |
---|
ProcfsBasedProcessTree(java.lang.String pid) |
ProcfsBasedProcessTree(java.lang.String pid,
boolean setsidUsed) |
ProcfsBasedProcessTree(java.lang.String pid,
boolean setsidUsed,
long sigkillInterval) |
ProcfsBasedProcessTree(java.lang.String pid,
boolean setsidUsed,
long sigkillInterval,
java.lang.String procfsDir)
Build a new process tree rooted at the pid.
|
ProcfsBasedProcessTree(java.lang.String pid,
java.lang.String procfsDir) |
Modifier and Type | Method and Description |
---|---|
static void |
assertAndDestroyProcessGroup(java.lang.String pgrpId,
long interval,
boolean inBackground)
Make sure that the given pid is a process group leader and then
destroy the process group.
|
void |
destroy()
Destroy the process-tree.
|
void |
destroy(boolean inBackground)
Destroy the process-tree.
|
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.
|
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.
|
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.
|
ProcfsBasedProcessTree |
getProcessTree()
Get the process-tree with latest state.
|
java.lang.String |
getProcessTreeDump()
Get a dump of the process-tree.
|
boolean |
isAlive()
Is the root-process alive?
|
boolean |
isAnyProcessInTreeAlive()
Is any of the subprocesses in the process-tree alive?
|
static boolean |
isAvailable()
Checks if the ProcfsBasedProcessTree is available on this system.
|
void |
setSigKillInterval(long interval)
Deprecated.
Use
ProcfsBasedProcessTree(
String, boolean, long) instead |
java.lang.String |
toString()
Returns a string printing PIDs of process present in the
ProcfsBasedProcessTree.
|
destroy, destroyProcess, destroyProcessGroup, isAlive, isProcessGroupAlive, killProcess, killProcessGroup, terminateProcess, terminateProcessGroup
public static final long PAGE_SIZE
public static final long JIFFY_LENGTH_IN_MILLIS
public ProcfsBasedProcessTree(java.lang.String pid)
public ProcfsBasedProcessTree(java.lang.String pid, boolean setsidUsed)
public ProcfsBasedProcessTree(java.lang.String pid, java.lang.String procfsDir)
public ProcfsBasedProcessTree(java.lang.String pid, boolean setsidUsed, long sigkillInterval)
public ProcfsBasedProcessTree(java.lang.String pid, boolean setsidUsed, long sigkillInterval, java.lang.String procfsDir)
pid
- root of the process treesetsidUsed
- true, if setsid was used for the root pidsigkillInterval
- how long to wait between a SIGTERM and SIGKILL
when killing a process treeprocfsDir
- the root of a proc file system - only used for testing.@Deprecated public void setSigKillInterval(long interval)
ProcfsBasedProcessTree(
String, boolean, long)
insteadinterval
- The time to wait before sending SIGKILL
after sending SIGTERMpublic static boolean isAvailable()
public ProcfsBasedProcessTree getProcessTree()
public boolean isAlive()
public boolean isAnyProcessInTreeAlive()
public static void assertAndDestroyProcessGroup(java.lang.String pgrpId, long interval, boolean inBackground) throws java.io.IOException
pgrpId
- Process group id of to-be-killed-processesinterval
- The time to wait before sending SIGKILL
after sending SIGTERMinBackground
- Process is to be killed in the back ground with
a separate threadjava.io.IOException
public void destroy()
public void destroy(boolean inBackground)
inBackground
- Process is to be killed in the back ground with
a separate threadpublic java.lang.String getProcessTreeDump()
public long getCumulativeVmem()
public long getCumulativeRssmem()
public long getCumulativeVmem(int olderThanAge)
olderThanAge
- processes above this age are included in the
memory additionpublic long getCumulativeRssmem(int olderThanAge)
olderThanAge
- processes above this age are included in the
memory additionpublic long getCumulativeCpuTime()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2009 The Apache Software Foundation