public class ProcfsBasedProcessTree extends Object
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.paimon.benchmark.metric.cpu.ProcfsBasedProcessTree.ProcessTreeSmapMemInfo> |
processSMAPTree |
protected Map<String,org.apache.paimon.benchmark.metric.cpu.ProcfsBasedProcessTree.ProcessInfo> |
processTree |
static String |
PROCFS_CMDLINE_FILE |
static String |
PROCFS_STAT_FILE |
static String |
SMAPS |
static int |
UNAVAILABLE |
Constructor and Description |
---|
ProcfsBasedProcessTree() |
ProcfsBasedProcessTree(boolean smapsEnabled) |
ProcfsBasedProcessTree(String pid) |
ProcfsBasedProcessTree(String pid,
boolean smapsEnabled) |
ProcfsBasedProcessTree(String pid,
String procfsDir) |
ProcfsBasedProcessTree(String pid,
String procfsDir,
Clock clock,
boolean smapsEnabled)
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() |
List<String> |
getCurrentProcessIDs() |
String |
getProcessTreeDump()
Get a dump of the process-tree.
|
long |
getRssMemorySize() |
long |
getRssMemorySize(int olderThanAge) |
long |
getVirtualMemorySize() |
long |
getVirtualMemorySize(int olderThanAge) |
static void |
main(String[] args)
Test the
ProcfsBasedProcessTree |
void |
setSmapsEnabled(boolean smapsEnabled) |
String |
toString()
Returns a string printing PIDs of process present in the ProcfsBasedProcessTree.
|
void |
updateProcessTree()
Update process-tree with latest state.
|
public static final int UNAVAILABLE
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.paimon.benchmark.metric.cpu.ProcfsBasedProcessTree.ProcessTreeSmapMemInfo> processSMAPTree
public ProcfsBasedProcessTree() throws IOException
IOException
public ProcfsBasedProcessTree(boolean smapsEnabled) throws IOException
IOException
public ProcfsBasedProcessTree(String pid)
public ProcfsBasedProcessTree(String pid, boolean smapsEnabled)
public ProcfsBasedProcessTree(String pid, String procfsDir, Clock clock, boolean smapsEnabled)
This method is provided mainly for testing purposes, where the root of the proc file system can be adjusted.
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 setSmapsEnabled(boolean smapsEnabled)
public void updateProcessTree()
public boolean checkPidPgrpidForMatch()
public String getProcessTreeDump()
public long getVirtualMemorySize()
public long getVirtualMemorySize(int olderThanAge)
public long getRssMemorySize()
public long getRssMemorySize(int olderThanAge)
public long getCumulativeCpuTime()
public float getCpuUsagePercent()
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 © 2023–2024 The Apache Software Foundation. All rights reserved.