|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.counters.HistoryInstrument<T>
T - Which must be Double, Long, or String.public class HistoryInstrument<T>
A history instrument which aggregates samples into a circular buffer with a
specified sample period. Old samples are overwritten (or cleared in the case
of missed samples) only as new samples arrive. The value reported for a given
moment is the average of the samples which were aggregated into the same slot
in the underlying History.
| Field Summary | |
|---|---|
History<T> |
days
|
History<T> |
hours
|
protected static org.apache.log4j.Logger |
log
|
History<T> |
minutes
|
| Constructor Summary | |
|---|---|
HistoryInstrument(History<T> minutes)
|
|
| Method Summary | |
|---|---|
void |
add(long timestamp,
T value)
Adds the sample to the history. |
History<T> |
getHistory()
Return the history data. |
History<T> |
getHistory(PeriodEnum basePeriod)
Return the History for the specified base period. |
T |
getValue()
Return the last value. |
long |
lastModified()
Return the timestamp associated with the last value. |
void |
setValue(T value,
long timestamp)
Adds the sample to the history. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static org.apache.log4j.Logger log
public final History<T> minutes
public final History<T> hours
public final History<T> days
| Constructor Detail |
|---|
public HistoryInstrument(History<T> minutes)
| Method Detail |
|---|
public History<T> getHistory()
public History<T> getHistory(PeriodEnum basePeriod)
History for the specified base period.
basePeriod - The base period.
public T getValue()
getValue in interface IInstrument<T>public long lastModified()
lastModified in interface IInstrument<T>
public void add(long timestamp,
T value)
timestamp - The timestamp.value - The value of the counter as of that timestamp.
public void setValue(T value,
long timestamp)
setValue in interface IInstrument<T>value - The sampled value.timestamp - The timestamp for that sample.public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||