Public Member Functions | |
abstract void | setEnabled (boolean enabled) |
If enabled, gather stats, otherwise do not. | |
abstract String[] | getCounterNames () |
Return a list of statistic counter names, in the preferred display order. | |
abstract 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. | |
abstract long | getCounter (String name) throws IllegalArgumentException |
Return the value of a counter. | |
abstract double[] | getAverageAndStdev (String name) throws IllegalArgumentException |
Return the average and standard deviation of a counter. | |
abstract String | getCounterUnits (String name) throws IllegalArgumentException |
Return a text description of the units of the counter (e.g. | |
abstract void | clearCounters () |
Reset all counters to zero. | |
abstract String | toString () |
Dump the counters in the preferred format to a String for display. | |
Classes | |
interface | CCNCategorizedStatistics |
class | CCNEnumStats< K extends Enum< K >> |
This is a helper class for implementing statistics. More... | |
interface | CCNStatistics |
class | ExampleClassWithStatistics |
It is the public API that a user would access to check or display performance counters. A class that counts statistics should implement CCNStatistics.
A typical usage is illustrated in ExampleClassWithStatistics at the end of this module. By using the helper class CCNEnumStats, a class with statistics only needs to define an enum of the stats it will use, and create a CCNEnumStats member with reference to that Enum.
Usage example is also shown in org.ccnx.ccn.test.impl.CCNStatsTest.java
The high-level abstractions are CCNStats and CCNStatistics. A typical user would only deal with those two things.
The mid-level abstractions are CCNEnumStats and IStatsEnum. These are for the developer of a class that uses CCNStats. The developer could, of course, do any implementation that implements CCNStatistics. The CCNEnumStats abstraction is to simplify the process so the developer only needs to define an Enum of the counters they want to use, and pass that to CCNEnumStats. The Enum must implement IStatsEnum. After that, the usage is very simple and automagically gives the CCNStats object needed by the CCNStatistics interface.
The interface CCNCategoriezedStatistics is for modules that keep statistics in several cateogries (e.g. for each ContentName you express an interest for).
Added support for an "averaging" counter. This will track the sum, sum^2, and count so one can get an average and standard deviation. Basically, there's a simple "long" counter and an "averaging counter" for each Enum, so you could use the normal "increment(item)" or the new "addSample(item, value)" calls on any of the Enums. If you call addSample(item, value), then the item "item" will be tagged as an averaging stat and the toString() method will format it as such.
Might want to add an EWMA type counter too. I think we'll want to expand the IStatsEnum to make it take a counter type argument.
abstract void org.ccnx.ccn.impl.CCNStats.setEnabled | ( | boolean | enabled | ) | [pure virtual] |
If enabled, gather stats, otherwise do not.
enabled |
Implemented in org.ccnx.ccn.impl.CCNStats.CCNEnumStats< K extends Enum< K >>.
abstract String [] org.ccnx.ccn.impl.CCNStats.getCounterNames | ( | ) | [pure virtual] |
Return a list of statistic counter names, in the preferred display order.
Implemented in org.ccnx.ccn.impl.CCNStats.CCNEnumStats< K extends Enum< K >>.
abstract long org.ccnx.ccn.impl.CCNStats.getCounter | ( | String | name | ) | throws IllegalArgumentException [pure virtual] |
Return the value of a counter.
name |
IllegalArgumentException | if name unrecognized |
Implemented in org.ccnx.ccn.impl.CCNStats.CCNEnumStats< K extends Enum< K >>.
abstract double [] org.ccnx.ccn.impl.CCNStats.getAverageAndStdev | ( | String | name | ) | throws IllegalArgumentException [pure virtual] |
Return the average and standard deviation of a counter.
You need to have been accumulating samples with the addSample(item, value) method.
name |
IllegalArgumentException | if name unrecognized |
Implemented in org.ccnx.ccn.impl.CCNStats.CCNEnumStats< K extends Enum< K >>.
abstract String org.ccnx.ccn.impl.CCNStats.getCounterUnits | ( | String | name | ) | throws IllegalArgumentException [pure virtual] |
Return a text description of the units of the counter (e.g.
packets, packets per second)
name |
IllegalArgumentException | if name unrecognized |
Implemented in org.ccnx.ccn.impl.CCNStats.CCNEnumStats< K extends Enum< K >>.