Top Inners Fields Constructors Methods
org.terracotta.statistics.derived

public Class EventRateSimpleMovingAverage

extends Object
implements ChainedEventObserver, ValueStatistic<Double>
Class Inheritance
All Implemented Interfaces
org.terracotta.statistics.ValueStatistic, org.terracotta.statistics.observer.ChainedEventObserver, org.terracotta.statistics.observer.ChainedObserver
Static Imports
org.terracotta.statistics.Time.time

Author
cdennis

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final AtomicReference<EventRateSimpleMovingAverage.CounterPartition>
private final Queue<EventRateSimpleMovingAverage.CounterPartition>
private static final int
private volatile long
private volatile long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
public void
event(long
the time of the event
time
,
long...
the event parameters
parameters
)

Implements org.terracotta.statistics.observer.ChainedEventObserver.event.

Called to indicate an event happened.
public Double
rate(TimeUnit base)

public Double
public void
setWindow(long time, TimeUnit unit)

public Double
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

activePartitionback to summary
private final AtomicReference<EventRateSimpleMovingAverage.CounterPartition> activePartition
archiveback to summary
private final Queue<EventRateSimpleMovingAverage.CounterPartition> archive
PARTITION_COUNTback to summary
private static final int PARTITION_COUNT
partitionSizeback to summary
private volatile long partitionSize
windowSizeback to summary
private volatile long windowSize

Constructor Detail

EventRateSimpleMovingAverageback to summary
public EventRateSimpleMovingAverage(long time, TimeUnit unit)

Method Detail

archiveback to summary
private void archive(EventRateSimpleMovingAverage.CounterPartition partition)
eventback to summary
public void event(long time, long... parameters)

Implements org.terracotta.statistics.observer.ChainedEventObserver.event.

Doc from org.terracotta.statistics.observer.ChainedEventObserver.event.

Called to indicate an event happened.

Parameters
time:long

the time of the event

parameters:long[]

the event parameters

Annotations
@Override
rateback to summary
public Double rate(TimeUnit base)
rateUsingSecondsback to summary
public Double rateUsingSeconds()
setWindowback to summary
public void setWindow(long time, TimeUnit unit)
valueback to summary
public Double value()

Implements org.terracotta.statistics.ValueStatistic.value.

Annotations
@Override
org.terracotta.statistics.derived back to summary

pack-priv Class EventRateSimpleMovingAverage.CounterPartition

extends LongAdder
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final long
private final long

Constructor Summary

AccessConstructor and Description
pack-priv
CounterPartition(long start, long length)

Method Summary

Modifier and TypeMethod and Description
public long
end()

public boolean
isBefore(long time)

public long
public boolean
targetFor(long time)

Inherited from java.util.concurrent.atomic.LongAdder:
adddecrementdoubleValuefloatValueincrementintValuelongValueresetsumsumThenResettoString

Field Detail

endback to summary
private final long end
startback to summary
private final long start

Constructor Detail

CounterPartitionback to summary
pack-priv CounterPartition(long start, long length)

Method Detail

endback to summary
public long end()
isBeforeback to summary
public boolean isBefore(long time)
startback to summary
public long start()
targetForback to summary
public boolean targetFor(long time)