|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.counters.linux.SysstatUtil
public class SysstatUtil
Some utility methods related to integration with sysstat.
| Field Summary | |
|---|---|
protected static boolean |
DEBUG
True iff the log level is DEBUG or less. |
protected static boolean |
INFO
True iff the log level is INFO or less. |
protected static org.apache.log4j.Logger |
log
|
| Constructor Summary | |
|---|---|
SysstatUtil()
|
|
| Method Summary | |
|---|---|
static File |
getPath()
Returns the path to the sysstat utilities (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). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.log4j.Logger log
protected static final boolean DEBUG
log level is DEBUG or less.
protected static final boolean INFO
log level is INFO or less.
| Constructor Detail |
|---|
public SysstatUtil()
| Method Detail |
|---|
public static final File getPath()
/usr/bin. This may be overriden using the
com.bigdata.counters.linux.sysstat.path property.
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 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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||