Package org.terracotta.statistics
Class MappedOperationStatistic<S extends Enum<S>,D extends Enum<D>>
- java.lang.Object
-
- org.terracotta.statistics.MappedOperationStatistic<S,D>
-
- All Implemented Interfaces:
OperationObserver<D>,OperationStatistic<D>,SourceStatistic<ChainedOperationObserver<? super D>>
public class MappedOperationStatistic<S extends Enum<S>,D extends Enum<D>> extends Object implements OperationStatistic<D>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDerivedStatistic(ChainedOperationObserver<? super D> derived)Register the givenObserverto be called by thisSourceStatisticvoidbegin()Called immediately prior to the operation beginning.longcount(D type)Return the count of operations with the given type.voidend(D result)Called immediately after the operation completes with no interesting parameters, and with the same thread the called {OperationObserver.begin()} before.Collection<ChainedOperationObserver<? super D>>getDerivedStatistics()Retrieve all registered statistics.voidremoveDerivedStatistic(ChainedOperationObserver<? super D> derived)Remove the given registeredObserverfrom thisSourceStatistic.ValueStatistic<Long>statistic(D result)Return aValueStatisticreturning the count for the given result.ValueStatistic<Long>statistic(Set<D> results)longsum()longsum(Set<D> types)Class<D>type()
-
-
-
Method Detail
-
statistic
public ValueStatistic<Long> statistic(D result)
Description copied from interface:OperationStatisticReturn aValueStatisticreturning the count for the given result.- Specified by:
statisticin interfaceOperationStatistic<S extends Enum<S>>- Parameters:
result- the result of interest- Returns:
- a
ValueStatisticinstance
-
statistic
public ValueStatistic<Long> statistic(Set<D> results)
- Specified by:
statisticin interfaceOperationStatistic<S extends Enum<S>>
-
count
public long count(D type)
Description copied from interface:OperationStatisticReturn the count of operations with the given type.- Specified by:
countin interfaceOperationStatistic<S extends Enum<S>>- Parameters:
type- the result type- Returns:
- the operation count
-
sum
public long sum(Set<D> types)
- Specified by:
sumin interfaceOperationStatistic<S extends Enum<S>>
-
sum
public long sum()
- Specified by:
sumin interfaceOperationStatistic<S extends Enum<S>>
-
addDerivedStatistic
public void addDerivedStatistic(ChainedOperationObserver<? super D> derived)
Description copied from interface:SourceStatisticRegister the givenObserverto be called by thisSourceStatistic- Specified by:
addDerivedStatisticin interfaceSourceStatistic<S extends Enum<S>>- Parameters:
derived- statistic to be registered
-
removeDerivedStatistic
public void removeDerivedStatistic(ChainedOperationObserver<? super D> derived)
Description copied from interface:SourceStatisticRemove the given registeredObserverfrom thisSourceStatistic.- Specified by:
removeDerivedStatisticin interfaceSourceStatistic<S extends Enum<S>>- Parameters:
derived- statistic to be removed
-
getDerivedStatistics
public Collection<ChainedOperationObserver<? super D>> getDerivedStatistics()
Description copied from interface:SourceStatisticRetrieve all registered statistics.- Specified by:
getDerivedStatisticsin interfaceSourceStatistic<S extends Enum<S>>- Returns:
- an unmodifiable collection of all derived statistics
-
begin
public void begin()
Description copied from interface:OperationObserverCalled immediately prior to the operation beginning.- Specified by:
beginin interfaceOperationObserver<S extends Enum<S>>
-
end
public void end(D result)
Description copied from interface:OperationObserverCalled immediately after the operation completes with no interesting parameters, and with the same thread the called {OperationObserver.begin()} before.- Specified by:
endin interfaceOperationObserver<S extends Enum<S>>- Parameters:
result- the operation result
-
-