com.neeve.stats
Interface IStats.Counter

Enclosing interface:
IStats

public static interface IStats.Counter

Interface used to collect and provide access to a monotonically increasing counter.

A IStats.Counter is useful for recording an increasing value over time. Sampled periodically it can be used to derive a rate. For example a counter could be used to record a number of message received. By sampling it over time it can be used to create a received message rate.


Method Summary
 void compute()
          Computes statistic values.
 void get(StringBuilder builder, NumberFormat format)
          Appends the counter value and any computed stats calculated by compute() to the provided StringBuilder.
 long getCount()
          Gets the current counter value.
 String getName()
          Gets statistic name.
 XString getNameAsRaw()
          Gets the stat's name as a XString.
 void increment()
          Increments the counter.
 void increment(int count)
          Increments the counter.
 void reset()
          Clears and resets the counter.
 

Method Detail

getName

String getName()
Gets statistic name.

Returns:
The statistic name

getNameAsRaw

XString getNameAsRaw()
Gets the stat's name as a XString.

Returns:
The statistic name in raw form

increment

void increment()
Increments the counter.


increment

void increment(int count)
Increments the counter.

Parameters:
count - The amount to increment (must be positive)

getCount

long getCount()
Gets the current counter value.

Returns:
The current counter value.

compute

void compute()
Computes statistic values. This method may be called periodically by a stat thread allowing stats based on the counter to be computed.

Threading:
This method should only be called periodically by a single statistics output thread as it records interval based stats.

get

void get(StringBuilder builder,
         NumberFormat format)
Appends the counter value and any computed stats calculated by compute() to the provided StringBuilder.


reset

void reset()
Clears and resets the counter.

Threading:
The method is not safe for concurrent access by multiple threads.


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.