public abstract class AbstractCounterSet extends Object implements ICounterSet
ICounterSet.IInstrumentFactory| Modifier and Type | Field and Description |
|---|---|
protected String |
name |
protected AbstractCounterSet |
parent |
pathSeparator| Modifier | Constructor and Description |
|---|---|
protected |
AbstractCounterSet(String name,
CounterSet parent) |
| Modifier and Type | Method and Description |
|---|---|
void |
asXML(OutputStream os,
String encoding,
Pattern filter)
Uses a post-order iteration to visit the
CounterSets and for
each CounterSet writes the current value of each Counter. |
String |
asXML(Pattern filter)
Writes out the
ICounterSet as XML on a string and returns that
string. |
void |
asXML(Writer w,
String encoding,
Pattern filter)
Alternative, but you are still required to specify the character set
encoding in use by the writer.
|
int |
getDepth()
Depth of this node in the hierarchy, where the depth of the root is ZERO
(0).
|
String |
getName()
The local name (does not include the path from the root).
|
ICounterSet |
getParent()
The immediate parent in the hierarchy -or-
null iff this
is the root of the hierarchy. |
String |
getPath()
Complete path from the root inclusive of the local name.
|
ICounterNode |
getPath(String path)
Return the object described by the path.
|
ICounterSet[] |
getPathComponents()
The ordered array of counter sets from the root.
|
AbstractCounterSet |
getRoot()
The root of the hierarchy.
|
boolean |
isCounter()
true iff this is a counter. |
boolean |
isCounterSet()
true iff this is a collection of counters. |
boolean |
isRoot()
true iff this is the root of the hierarchy. |
String |
toString()
A human readable representation of all counters in the hierarchy together
with their current value.
|
String |
toString(Pattern filter)
A human readable representation of the counters in the hierarchy together
with their current value.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitasXML, getCounters, makePath, readXMLgetChildprotected final String name
protected AbstractCounterSet parent
protected AbstractCounterSet(String name, CounterSet parent)
public AbstractCounterSet getRoot()
ICounterNodegetRoot in interface ICounterNodepublic String getName()
ICounterNodegetName in interface ICounterNodepublic ICounterSet[] getPathComponents()
public String getPath()
ICounterNodegetPath in interface ICounterNodepublic int getDepth()
ICounterNodegetDepth in interface ICounterNodepublic ICounterNode getPath(String path)
ICounterNodegetPath in interface ICounterNodepath - The path.null if nothing exists for that
path.public ICounterSet getParent()
ICounterNodenull iff this
is the root of the hierarchy.getParent in interface ICounterNodepublic boolean isRoot()
ICounterNodetrue iff this is the root of the hierarchy.isRoot in interface ICounterNodepublic String toString()
ICounterSettoString in interface ICounterSettoString in class Objectpublic String toString(Pattern filter)
ICounterSettoString in interface ICounterSetfilter - An optional filter that will be used to select only specific
counters.public final boolean isCounterSet()
ICounterNodetrue iff this is a collection of counters.isCounterSet in interface ICounterNodepublic final boolean isCounter()
ICounterNodetrue iff this is a counter.isCounter in interface ICounterNodepublic void asXML(OutputStream os, String encoding, Pattern filter) throws IOException
CounterSets and for
each CounterSet writes the current value of each Counter.
A sample output is below.
cs is a CounterSet element and has a
path attribute which expresses the location of the counter
set within the hierarchy (counter set elements are not nested inside of
each other in the XML serialization). Only counter sets with counters are
emitted.
c is a Counter element and is nested inside of the
corresponding counter set. Each counter carries a name
attribute, a simple XML Schema Datatype, a timestamp (milliseconds since
the epoch per System.currentTimeMillis(), and has a counter
value which is the inner content of the c element.
<?xml version="1.0" encoding="UTF-8"?>
<counters xmlns:xs="http://www.w3.org/2001/XMLSchema">
<cs path="/www.bigdata.com/cpu">
<c name="availableProcessors" type="xs:int" time="1205928108602">2</c>
</cs>
<cs path="/www.bigdata.com/memory">
<c name="maxMemory" type="xs:long" time="1205928108602">517013504</c>
</cs>
<cs path="/">
<c name="elapsed" type="xs:long" time="1205928108602">1205928108602</c>
</cs>
</counters>
asXML in interface ICounterSetos - The sink on which the representation will be written.encoding - The character set encoding that will be used, e.g.,
UTF-8.filter - An optional filter that will be used to select only specific
counters.IOExceptionpublic void asXML(Writer w, String encoding, Pattern filter) throws IOException
w - The writer.encoding - The character set encoding used by that writer.filter - An optional filter.IOExceptionpublic String asXML(Pattern filter)
ICounterSetICounterSet as XML on a string and returns that
string.asXML in interface ICounterSetfilter - An optional filter.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.