|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.floodlightcontroller.debugevent.DebugEvent
public class DebugEvent
This class implements a central store for all events used for debugging the system. The basic idea is that given the functionality provided by this class, it should be unnecessary to resort to scraping through system DEBUG/TRACE logs to understand behavior in a running system.
Nested Class Summary | |
---|---|
protected class |
DebugEvent.DebugEventHistory
Event history for a particular event-id is stored in a circular buffer |
class |
DebugEvent.EventInfo
Event Information |
protected class |
DebugEvent.EventUpdaterImpl<T>
|
protected class |
DebugEvent.LocalEventHistory
Thread local storage for events |
Nested classes/interfaces inherited from interface net.floodlightcontroller.debugevent.IDebugEventService |
---|
IDebugEventService.DebugEventInfo, IDebugEventService.EventColumn, IDebugEventService.EventFieldType, IDebugEventService.EventType, IDebugEventService.MaxEventsRegistered |
Field Summary | |
---|---|
protected DebugEvent.DebugEventHistory[] |
allEvents
Global storage for all event types and their corresponding event buffers. |
protected java.util.Set<java.lang.Integer> |
currentEvents
A collection of event ids that are currently enabled for logging |
protected int |
eventIdCounter
Every registered event type gets an event id, the value for which is obtained while holding the lock. |
protected java.lang.Object |
eventIdLock
|
protected static org.slf4j.Logger |
log
|
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.Integer>> |
moduleEvents
Global storage for all event ids registered for a module. |
protected java.lang.ThreadLocal<java.util.Set<java.lang.Integer>> |
threadlocalCurrentEvents
Thread local cache for event-ids that are currently active. |
protected java.lang.ThreadLocal<DebugEvent.LocalEventHistory[]> |
threadlocalEvents
Thread local event buffers used for maintaining event history local to a thread. |
Fields inherited from interface net.floodlightcontroller.debugevent.IDebugEventService |
---|
EV_MDATA_ERROR, EV_MDATA_WARN, MAX_EVENTS |
Constructor Summary | |
---|---|
DebugEvent()
|
Method Summary | ||
---|---|---|
boolean |
containsModuleEventName(java.lang.String moduleName,
java.lang.String eventName)
Determine if eventName is a registered event for a given moduleName |
|
boolean |
containsModuleName(java.lang.String moduleName)
Determine if any events have been registered for module of name moduleName |
|
void |
flushEvents()
Update the global event stores with values from the thread local stores. |
|
java.util.List<IDebugEventService.DebugEventInfo> |
getAllEventHistory()
Get event history for all events. |
|
java.util.Collection<java.lang.Class<? extends IFloodlightService>> |
getModuleDependencies()
Get a list of Modules that this module depends on. |
|
java.util.List<IDebugEventService.DebugEventInfo> |
getModuleEventHistory(java.lang.String moduleName)
Get event history for all events registered for a given moduleName |
|
java.util.List<java.lang.String> |
getModuleEventList(java.lang.String moduleName)
Returns a list of all events registered for a specific moduleName or a empty list |
|
java.util.List<java.lang.String> |
getModuleList()
Retrieve a list of moduleNames registered for debug events or an empty list if no events 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. |
|
IDebugEventService.DebugEventInfo |
getSingleEventHistory(java.lang.String moduleName,
java.lang.String eventName,
int last)
Get event history for a single event |
|
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. |
|
|
registerEvent(java.lang.String moduleName,
java.lang.String eventName,
java.lang.String eventDescription,
IDebugEventService.EventType et,
java.lang.Class<T> eventClass,
int bufferCapacity,
java.lang.String... metaData)
Register an event for debugging. |
|
void |
resetAllEvents()
Wipe out all event history for all registered events |
|
void |
resetAllModuleEvents(java.lang.String moduleName)
Wipe out all event history for all events registered for a specific module |
|
void |
resetSingleEvent(java.lang.String moduleName,
java.lang.String eventName)
Wipe out event history for a single event |
|
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 int eventIdCounter
protected java.lang.Object eventIdLock
protected DebugEvent.DebugEventHistory[] allEvents
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.Integer>> moduleEvents
protected java.util.Set<java.lang.Integer> currentEvents
protected final java.lang.ThreadLocal<DebugEvent.LocalEventHistory[]> threadlocalEvents
protected final java.lang.ThreadLocal<java.util.Set<java.lang.Integer>> threadlocalCurrentEvents
Constructor Detail |
---|
public DebugEvent()
Method Detail |
---|
public <T> IEventUpdater<T> registerEvent(java.lang.String moduleName, java.lang.String eventName, java.lang.String eventDescription, IDebugEventService.EventType et, java.lang.Class<T> eventClass, int bufferCapacity, java.lang.String... metaData) throws IDebugEventService.MaxEventsRegistered
IDebugEventService
registerEvent
in interface IDebugEventService
moduleName
- module registering event eg. linkdiscovery, virtualrouting.eventName
- name given to event.eventDescription
- A descriptive string describing the event.et
- EventType for this event. On-demand events have to
be explicitly enabled using other methods in this APIeventClass
- A user defined class that annotates the fields
with @EventColumn. This class specifies the
fields/columns for this event.bufferCapacity
- Number of events to store for this event in a circular
buffer. Older events will be discarded once the
buffer is full.metaData
- variable arguments that qualify an event
eg. EV_MDATA_WARN, EV_MDATA_ERROR etc. See Debug Event Qualifiers
IDebugEventService.MaxEventsRegistered
public void flushEvents()
IDebugEventService
flushEvents
in interface IDebugEventService
public boolean containsModuleEventName(java.lang.String moduleName, java.lang.String eventName)
IDebugEventService
containsModuleEventName
in interface IDebugEventService
public boolean containsModuleName(java.lang.String moduleName)
IDebugEventService
containsModuleName
in interface IDebugEventService
public java.util.List<IDebugEventService.DebugEventInfo> getAllEventHistory()
IDebugEventService
getAllEventHistory
in interface IDebugEventService
public java.util.List<IDebugEventService.DebugEventInfo> getModuleEventHistory(java.lang.String moduleName)
IDebugEventService
getModuleEventHistory
in interface IDebugEventService
public IDebugEventService.DebugEventInfo getSingleEventHistory(java.lang.String moduleName, java.lang.String eventName, int last)
IDebugEventService
getSingleEventHistory
in interface IDebugEventService
moduleName
- registered module nameeventName
- registered event name for moduleNamelast
- last X events
public void resetAllEvents()
IDebugEventService
resetAllEvents
in interface IDebugEventService
public void resetAllModuleEvents(java.lang.String moduleName)
IDebugEventService
resetAllModuleEvents
in interface IDebugEventService
moduleName
- registered module namepublic void resetSingleEvent(java.lang.String moduleName, java.lang.String eventName)
IDebugEventService
resetSingleEvent
in interface IDebugEventService
moduleName
- registered module nameeventName
- registered event name for moduleNamepublic java.util.List<java.lang.String> getModuleList()
IDebugEventService
getModuleList
in interface IDebugEventService
public java.util.List<java.lang.String> getModuleEventList(java.lang.String moduleName)
IDebugEventService
getModuleEventList
in interface IDebugEventService
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) throws FloodlightModuleException
IFloodlightModule
startUp
in interface IFloodlightModule
FloodlightModuleException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |