public abstract class Instrument<T> extends Object implements IInstrument<T>
Modifier and Type | Field and Description |
---|---|
protected long |
lastModified
The timestamp associated with
value . |
protected static org.apache.log4j.Logger |
log |
protected static String |
NA
N/A |
protected T |
value
The current value -or-
null if there is no current value. |
Constructor and Description |
---|
Instrument() |
Modifier and Type | Method and Description |
---|---|
T |
getCurrentValue()
Return the current value without taking another
sample() |
T |
getValue()
Obtain a sample.
|
long |
lastModified()
Obtain the timestamp for the last collected sample.
|
String |
nanosToPerSec(long counter,
long nanos)
Converts an event count whose durations were measured in elapsed
nanoseconds to an event rate per second.
|
protected abstract void |
sample()
Take a sample, setting the current value and timestamp using either
setValue(Object) or setValue(Object, long) . |
void |
setValue(T value)
Set the value.
|
void |
setValue(T value,
long timestamp)
Set the value.
|
protected static org.apache.log4j.Logger log
protected static final transient String NA
N/A
protected T value
null
if there is no current value.protected long lastModified
value
.public final String nanosToPerSec(long counter, long nanos)
counter
- The event count.nanos
- The elapsed nanoseconds for the events.protected abstract void sample()
setValue(Object)
or setValue(Object, long)
.public final void setValue(T value)
value
- The value, which will be associated with the current time as
reported by System.currentTimeMillis()
.public final void setValue(T value, long timestamp)
setValue
in interface IInstrument<T>
value
- The value.timestamp
- The timestamp for that value.public final T getValue()
IInstrument
getValue
in interface IInstrument<T>
public final long lastModified()
IInstrument
lastModified
in interface IInstrument<T>
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.