|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.floodlightcontroller.debugcounter.DebugCounter
public class DebugCounter
This class implements a central store for all counters used for debugging the system. For counters based on traffic-type, see ICounterStoreService.
Nested Class Summary | |
---|---|
protected class |
DebugCounter.CounterImpl
|
protected class |
DebugCounter.CounterIndexStore
|
static class |
DebugCounter.CounterInfo
protected class to store counter information |
class |
DebugCounter.DebugCounterInfo
Counter info for a debug counter |
protected class |
DebugCounter.LocalCounterInfo
Thread local storage of counter info |
protected class |
DebugCounter.MutableLong
The counter value |
protected class |
DebugCounter.RetCtrInfo
|
Nested classes/interfaces inherited from interface net.floodlightcontroller.debugcounter.IDebugCounterService |
---|
IDebugCounterService.CounterException, IDebugCounterService.CounterType, IDebugCounterService.MaxCountersRegistered, IDebugCounterService.MaxHierarchyRegistered, IDebugCounterService.MissingHierarchicalLevel |
Field Summary | |
---|---|
protected static DebugCounter.DebugCounterInfo[] |
allCounters
Global debug-counter storage across all threads. |
protected java.util.concurrent.atomic.AtomicInteger |
counterIdCounter
registered counters need a counter id |
protected java.util.Set<java.lang.Integer> |
currentCounters
fast global cache for counter ids that are currently active |
protected static org.slf4j.Logger |
log
|
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.concurrent.ConcurrentHashMap<java.lang.String,DebugCounter.CounterIndexStore>> |
moduleCounters
per module counters, indexed by the module name and storing three levels of Counter information in the form of CounterIndexStore |
protected java.lang.ThreadLocal<DebugCounter.LocalCounterInfo[]> |
threadlocalCounters
Thread local debug counters used for maintaining counters local to a thread. |
protected java.lang.ThreadLocal<java.util.Set<java.lang.Integer>> |
threadlocalCurrentCounters
Thread local cache for counter ids that are currently active. |
Fields inherited from interface net.floodlightcontroller.debugcounter.IDebugCounterService |
---|
CTR_MDATA_ERROR, CTR_MDATA_WARN, MAX_COUNTERS, MAX_HIERARCHY |
Constructor Summary | |
---|---|
DebugCounter()
|
Method Summary | |
---|---|
protected void |
addToModuleCounterHierarchy(java.lang.String moduleName,
int counterId,
DebugCounter.RetCtrInfo rci)
|
boolean |
containsModuleCounterHierarchy(java.lang.String moduleName,
java.lang.String counterHierarchy)
Convenience method to figure out if the the given 'counterHierarchy' corresponds to a registered counterHierarchy for 'moduleName'. |
boolean |
containsModuleName(java.lang.String moduleName)
Convenience method to figure out if the the given 'moduleName' corresponds to a registered moduleName or not. |
void |
disableCtrOnDemand(java.lang.String moduleName,
java.lang.String counterHierarchy)
This method applies only to CounterType.COUNT_ON_DEMAND. |
void |
enableCtrOnDemand(java.lang.String moduleName,
java.lang.String counterHierarchy)
This method applies only to CounterType.COUNT_ON_DEMAND. |
void |
flushCounters()
Flush all thread-local counter values (from the current thread) to the global counter store. |
java.util.List<DebugCounter.DebugCounterInfo> |
getAllCounterValues()
Get counter values and associated information for all counters in the system |
java.util.List<DebugCounter.DebugCounterInfo> |
getCounterHierarchy(java.lang.String moduleName,
java.lang.String counterHierarchy)
Get counter value and associated information for the specified counterHierarchy. |
protected DebugCounter.RetCtrInfo |
getCounterId(java.lang.String moduleName,
java.lang.String counterHierarchy)
|
protected java.util.ArrayList<java.lang.Integer> |
getHierarchyBelow(java.lang.String moduleName,
DebugCounter.RetCtrInfo rci)
|
protected void |
getIdsAtLevel(java.util.Map<java.lang.String,DebugCounter.CounterIndexStore> hcy,
java.util.ArrayList<java.lang.Integer> retval,
int level)
|
java.util.List<java.lang.String> |
getModuleCounterList(java.lang.String moduleName)
Returns a list of all counters registered for a specific moduleName or a empty list |
java.util.List<DebugCounter.DebugCounterInfo> |
getModuleCounterValues(java.lang.String moduleName)
Get counter values and associated information for all counters associated with a module. |
java.util.Collection<java.lang.Class<? extends IFloodlightService>> |
getModuleDependencies()
Get a list of Modules that this module depends on. |
java.util.List<java.lang.String> |
getModuleList()
Returns a list of moduleNames registered for debug counters or an empty list if no counters have been registered in the system |
java.util.Collection<java.lang.Class<? extends IFloodlightService>> |
getModuleServices()
Return the list of interfaces that this module implements. |
java.util.Map<java.lang.Class<? extends IFloodlightService>,IFloodlightService> |
getServiceImpls()
Instantiate (as needed) and return objects that implement each of the services exported by this module. |
void |
init(FloodlightModuleContext context)
This is a hook for each module to do its internal initialization, e.g., call setService(context.getService("Service")) All module dependencies are resolved when this is called, but not every module is initialized. |
protected void |
printAllCounterIds()
|
IDebugCounter |
registerCounter(java.lang.String moduleName,
java.lang.String counterHierarchy,
java.lang.String counterDescription,
IDebugCounterService.CounterType counterType,
java.lang.String... metaData)
All modules that wish to have the DebugCounterService count for them, must register their counters by making this call (typically from that module's 'startUp' method). |
void |
resetAllCounters()
Resets the values of all counters in the system. |
void |
resetAllModuleCounters(java.lang.String moduleName)
Resets the values of all counters belonging to a module with the given 'moduleName'. |
void |
resetCounterHierarchy(java.lang.String moduleName,
java.lang.String counterHierarchy)
Resets the value of counters in the hierarchy to zero. |
void |
startUp(FloodlightModuleContext context)
This is a hook for each module to do its external initializations, e.g., register for callbacks or query for state in other modules It is expected that this function will not block and that modules that want non-event driven CPU will spawn their own threads. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static org.slf4j.Logger log
protected java.util.concurrent.atomic.AtomicInteger counterIdCounter
protected static DebugCounter.DebugCounterInfo[] allCounters
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.concurrent.ConcurrentHashMap<java.lang.String,DebugCounter.CounterIndexStore>> moduleCounters
protected java.util.Set<java.lang.Integer> currentCounters
protected final java.lang.ThreadLocal<DebugCounter.LocalCounterInfo[]> threadlocalCounters
protected final java.lang.ThreadLocal<java.util.Set<java.lang.Integer>> threadlocalCurrentCounters
Constructor Detail |
---|
public DebugCounter()
Method Detail |
---|
public IDebugCounter registerCounter(java.lang.String moduleName, java.lang.String counterHierarchy, java.lang.String counterDescription, IDebugCounterService.CounterType counterType, java.lang.String... metaData) throws IDebugCounterService.MaxCountersRegistered, IDebugCounterService.MaxHierarchyRegistered, IDebugCounterService.MissingHierarchicalLevel
IDebugCounterService
registerCounter
in interface IDebugCounterService
moduleName
- the name of the module which is registering the
counter eg. linkdiscovery or controller or switchcounterHierarchy
- the hierarchical counter name specifying all
the hierarchical levels that come above it.
For example: to register a drop counter for
packet-ins from a switch, the counterHierarchy
can be "00:00:00:00:01:02:03:04/pktin/drops"
It is necessary that counters in hierarchical levels
above have already been pre-registered - in this
example: "00:00:00:00:01:02:03:04/pktin" and
"00:00:00:00:01:02:03:04"counterDescription
- a descriptive string that gives more information
of what the counter is measuring. For example,
"Measures the number of incoming packets seen by
this module".counterType
- One of CounterType. On-demand counter types
need to be explicitly enabled/disabled using other
methods in this API -- i.e. registering them is
not enough to start counting.metaData
- variable arguments that qualify a counter
eg. warn, error etc.
IDebugCounterService.MaxCountersRegistered
IDebugCounterService.MaxHierarchyRegistered
IDebugCounterService.MissingHierarchicalLevel
public void flushCounters()
IDebugCounterService
flushCounters
in interface IDebugCounterService
public void resetCounterHierarchy(java.lang.String moduleName, java.lang.String counterHierarchy)
IDebugCounterService
resetCounterHierarchy
in interface IDebugCounterService
public void resetAllCounters()
IDebugCounterService
resetAllCounters
in interface IDebugCounterService
public void resetAllModuleCounters(java.lang.String moduleName)
IDebugCounterService
resetAllModuleCounters
in interface IDebugCounterService
public void enableCtrOnDemand(java.lang.String moduleName, java.lang.String counterHierarchy)
IDebugCounterService
enableCtrOnDemand
in interface IDebugCounterService
public void disableCtrOnDemand(java.lang.String moduleName, java.lang.String counterHierarchy)
IDebugCounterService
disableCtrOnDemand
in interface IDebugCounterService
public java.util.List<DebugCounter.DebugCounterInfo> getCounterHierarchy(java.lang.String moduleName, java.lang.String counterHierarchy)
IDebugCounterService
getCounterHierarchy
in interface IDebugCounterService
public java.util.List<DebugCounter.DebugCounterInfo> getAllCounterValues()
IDebugCounterService
getAllCounterValues
in interface IDebugCounterService
public java.util.List<DebugCounter.DebugCounterInfo> getModuleCounterValues(java.lang.String moduleName)
IDebugCounterService
getModuleCounterValues
in interface IDebugCounterService
public boolean containsModuleCounterHierarchy(java.lang.String moduleName, java.lang.String counterHierarchy)
IDebugCounterService
containsModuleCounterHierarchy
in interface IDebugCounterService
public boolean containsModuleName(java.lang.String moduleName)
IDebugCounterService
containsModuleName
in interface IDebugCounterService
public java.util.List<java.lang.String> getModuleList()
IDebugCounterService
getModuleList
in interface IDebugCounterService
public java.util.List<java.lang.String> getModuleCounterList(java.lang.String moduleName)
IDebugCounterService
getModuleCounterList
in interface IDebugCounterService
protected DebugCounter.RetCtrInfo getCounterId(java.lang.String moduleName, java.lang.String counterHierarchy)
protected void addToModuleCounterHierarchy(java.lang.String moduleName, int counterId, DebugCounter.RetCtrInfo rci)
protected java.util.ArrayList<java.lang.Integer> getHierarchyBelow(java.lang.String moduleName, DebugCounter.RetCtrInfo rci)
protected void getIdsAtLevel(java.util.Map<java.lang.String,DebugCounter.CounterIndexStore> hcy, java.util.ArrayList<java.lang.Integer> retval, int level)
protected void printAllCounterIds()
public java.util.Collection<java.lang.Class<? extends IFloodlightService>> getModuleServices()
IFloodlightModule
getModuleServices
in interface IFloodlightModule
public java.util.Map<java.lang.Class<? extends IFloodlightService>,IFloodlightService> getServiceImpls()
IFloodlightModule
getServiceImpls
in interface IFloodlightModule
public java.util.Collection<java.lang.Class<? extends IFloodlightService>> getModuleDependencies()
IFloodlightModule
getModuleDependencies
in interface IFloodlightModule
public void init(FloodlightModuleContext context) throws FloodlightModuleException
IFloodlightModule
init
in interface IFloodlightModule
FloodlightModuleException
public void startUp(FloodlightModuleContext context)
IFloodlightModule
startUp
in interface IFloodlightModule
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |