java.lang.Object
org.elasticsearch.script.TimeSeriesCounter.Counter
- Enclosing class:
TimeSeriesCounter
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final long[]
protected int
protected final long
protected final long
protected long
-
Constructor Summary
ConstructorsConstructorDescriptionCounter
(long resolution, long duration) Create a Counter that covers duration seconds at the given resolution. -
Method Summary
-
Field Details
-
resolution
protected final long resolution -
duration
protected final long duration -
buckets
protected final long[] buckets -
startOfCurrentEpoch
protected long startOfCurrentEpoch -
curBucket
protected int curBucket
-
-
Constructor Details
-
Counter
public Counter(long resolution, long duration) Create a Counter that covers duration seconds at the given resolution. Duration must be divisible by resolution.
-
-
Method Details
-
inc
public void inc(long now) Increment the counter at timenow
, expressed in seconds. -
sum
public long sum(long now) sum for the duration of the counter untilnow
.
-