This is the base class for performance counters. More...
Classes | |
interface | CCNCategorizedStatistics |
class | CCNEnumStats< K extends Enum< K > > |
This is a helper class for implementing statistics. More... | |
interface | CCNStatistics |
class | ExampleClassWithStatistics |
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 long | getCounter (String name) throws IllegalArgumentException |
Return the value 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. |
This is the base class for performance counters.
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).
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 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 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 > >.
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 > >.