org.ccnx.ccn.impl.CCNStats.CCNEnumStats< K extends Enum< K >> Class Reference

This is a helper class for implementing statistics. More...

Inheritance diagram for org.ccnx.ccn.impl.CCNStats.CCNEnumStats< K extends Enum< K >>:

org.ccnx.ccn.impl.CCNStats

List of all members.

Public Member Functions

 CCNEnumStats (IStatsEnum stats)
void clearCounters ()
 Reset all counters to zero.
boolean isAveragingCounter (String name) throws IllegalArgumentException
 Is the counter an averaging counter? This will only function correctly after the system is run for a while and we see if it is called with increment or addsample.
long getCounter (String name) throws IllegalArgumentException
 Return the value of a counter.
double[] getAverageAndStdev (String name) throws IllegalArgumentException
 Return the average and standard deviation of a counter.
String[] getCounterNames ()
 Return a list of statistic counter names, in the preferred display order.
String getCounterUnits (String name) throws IllegalArgumentException
 Return a text description of the units of the counter (e.g.
void setEnabled (boolean enabled)
 If enabled, gather stats, otherwise do not.
String toString ()
 Dump the counters in the preferred format to a String for display.
void increment (K key)
void increment (K key, int value)
void addSample (K key, long value)
 Add a sample to the averaging counter for the key.

Protected Attributes

final AtomicLong[] _counters
final IStatsEnum _resolver
boolean _enabled = true
final AveragingCounter[] _avgcounters

Classes

class  AveragingCounter
 This is used to track an averaging counter.
interface  IStatsEnum
 The statistics Enum used by "K extends Enum<K>" must implement this interface. More...


Detailed Description

This is a helper class for implementing statistics.

Member Function Documentation

long org.ccnx.ccn.impl.CCNStats.CCNEnumStats< K extends Enum< K >>.getCounter ( String  name  )  throws IllegalArgumentException [virtual]

Return the value of a counter.

Parameters:
name 
Returns:
Exceptions:
IllegalArgumentException if name unrecognized

Implements org.ccnx.ccn.impl.CCNStats.

double [] org.ccnx.ccn.impl.CCNStats.CCNEnumStats< K extends Enum< K >>.getAverageAndStdev ( String  name  )  throws IllegalArgumentException [virtual]

Return the average and standard deviation of a counter.

You need to have been accumulating samples with the addSample(item, value) method.

Parameters:
name 
Returns:
[avg, stdev] array. May be NaN.
Exceptions:
IllegalArgumentException if name unrecognized

Implements org.ccnx.ccn.impl.CCNStats.

String [] org.ccnx.ccn.impl.CCNStats.CCNEnumStats< K extends Enum< K >>.getCounterNames (  )  [virtual]

Return a list of statistic counter names, in the preferred display order.

Returns:

Implements org.ccnx.ccn.impl.CCNStats.

String org.ccnx.ccn.impl.CCNStats.CCNEnumStats< K extends Enum< K >>.getCounterUnits ( String  name  )  throws IllegalArgumentException [virtual]

Return a text description of the units of the counter (e.g.

packets, packets per second)

Parameters:
name 
Returns:
Exceptions:
IllegalArgumentException if name unrecognized

Implements org.ccnx.ccn.impl.CCNStats.

void org.ccnx.ccn.impl.CCNStats.CCNEnumStats< K extends Enum< K >>.setEnabled ( boolean  enabled  )  [virtual]

If enabled, gather stats, otherwise do not.

Parameters:
enabled 

Implements org.ccnx.ccn.impl.CCNStats.

void org.ccnx.ccn.impl.CCNStats.CCNEnumStats< K extends Enum< K >>.addSample ( key,
long  value 
)

Add a sample to the averaging counter for the key.

This make the key an averaging counter as reported by toString().


The documentation for this class was generated from the following file:

Generated on Thu Feb 16 00:44:52 2012 for Content-Centric Networking in Java by  doxygen 1.5.6