public class SysstatUtil extends Object
sysstat
.Modifier and Type | Class and Description |
---|---|
static interface |
SysstatUtil.Options |
Constructor and Description |
---|
SysstatUtil() |
Modifier and Type | Method and Description |
---|---|
static Map<String,String> |
getDataMap(String header,
String data)
Takes header and data lines and generates a Map
|
static File |
getPath(String cmd)
Returns the path to the specified sysstat utility (pidstat, sar, etc).
|
static DateFormat |
newDateFormat()
Deprecated.
sysstat only reports the TIME OF DAY. In order to get the UTC
time it has to be corrected by the UTC time of the start of
the current day. Since very little latency is expected
between the report by sysstat of its performance counters and
the parsing of those performance counters by our code, it is
MUCH easier and more robust to simply use the current time as
reported by
System.currentTimeMillis() . |
static String[] |
splitDataLine(String data)
Splits a data line into fields based on whitespace and skipping over the
date field (index zero (0) is the index of the first non-date field).
|
public static final File getPath(String cmd)
public static String[] splitDataLine(String data)
Note: Some fields can overflow, e.g., RSS. When this happens the fields
in the data lines wind up eating into the whitespace to their
right. This means that it is more robust to split the lines
based on whitespace once we have skipped over the date field. Since we
specify using PIDStatCollector.setEnvironment(Map)
that we want
an ISO date format, we know that the date field is 11 characters. The
data lines are broken up by whitespace after that.
Note: Since we split on whitespace, the resulting strings are already trimmed.
public static Map<String,String> getDataMap(String header, String data)
public static DateFormat newDateFormat()
System.currentTimeMillis()
.Note: This assumes that you have controlled the date format using the sysstat ISO date option.
Note: This is not thread-safe - use a distinct instance for each
PIDStatCollector
or SarCpuUtilizationCollector
.
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.