net.floodlightcontroller.perfmon
Class PktInProcessingTime

java.lang.Object
  extended by net.floodlightcontroller.perfmon.PktInProcessingTime
All Implemented Interfaces:
IFloodlightModule, IFloodlightService, IPktInProcessingTimeService

public class PktInProcessingTime
extends java.lang.Object
implements IFloodlightModule, IPktInProcessingTimeService

This class contains a set of buckets (called time buckets as the primarily contain 'times' that are used in a circular way to store information on packet in processing time. Each bucket is meant to store the various processing time related data for a fixed duration. Buckets are reused to reduce garbage generation! Once the last bucket is used up the LRU bucket is reused. Naming convention for variable or constants variable_s : value in seconds variable_ms: value in milliseconds variable_us: value in microseconds variable_ns: value in nanoseconds Key Constants: ONE_BUCKET_DURATION_SECONDS_INT: time duration of each bucket BUCKET_SET_SIZE: Number of buckets TOT_PROC_TIME_WARN_THRESHOLD_US: if processing time for a packet exceeds this threshold then a warning LOG message is generated TOT_PROC_TIME_ALERT_THRESHOLD_US: same as above but an alert level syslog is generated instead


Field Summary
static java.lang.String COLUMN_ID
           
static java.lang.String COLUMN_PERF_MON
           
protected static java.lang.String ControllerTableName
           
protected  IFloodlightProviderService floodlightProvider
           
protected  boolean isEnabled
           
protected  boolean isInited
           
protected  long lastPktTime_ns
           
protected static org.slf4j.Logger logger
           
protected static long ONE_BUCKET_DURATION_NANOSECONDS
           
protected static int ONE_BUCKET_DURATION_SECONDS
          BUCKET_SET_SIZE buckets each holding 10s of processing time data, a total of 30*10s = 5mins of processing time data is maintained
protected  long ptWarningThresholdInNano
           
 
Constructor Summary
PktInProcessingTime()
           
 
Method Summary
 void bootstrap(java.util.List<IOFMessageListener> listeners)
          Creates time buckets for a set of modules to measure their performance
 CumulativeTimeBucket getCtb()
           
 java.util.Collection<java.lang.Class<? extends IFloodlightService>> getModuleDependencies()
          Get a list of Modules that this module depends on.
 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.
 boolean isEnabled()
           
 void recordEndTimeComp(IOFMessageListener listener)
           
 void recordEndTimePktIn(IOFSwitch sw, OFMessage m, FloodlightContext cntx)
           
 void recordStartTimeComp(IOFMessageListener listener)
          Stores a timestamp in ns.
 void recordStartTimePktIn()
           
 void setEnabled(boolean enabled)
           
 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

floodlightProvider

protected IFloodlightProviderService floodlightProvider

ptWarningThresholdInNano

protected long ptWarningThresholdInNano

ControllerTableName

protected static final java.lang.String ControllerTableName
See Also:
Constant Field Values

COLUMN_ID

public static final java.lang.String COLUMN_ID
See Also:
Constant Field Values

COLUMN_PERF_MON

public static final java.lang.String COLUMN_PERF_MON
See Also:
Constant Field Values

logger

protected static org.slf4j.Logger logger

isEnabled

protected boolean isEnabled

isInited

protected boolean isInited

lastPktTime_ns

protected long lastPktTime_ns

ONE_BUCKET_DURATION_SECONDS

protected static final int ONE_BUCKET_DURATION_SECONDS
BUCKET_SET_SIZE buckets each holding 10s of processing time data, a total of 30*10s = 5mins of processing time data is maintained

See Also:
Constant Field Values

ONE_BUCKET_DURATION_NANOSECONDS

protected static final long ONE_BUCKET_DURATION_NANOSECONDS
See Also:
Constant Field Values
Constructor Detail

PktInProcessingTime

public PktInProcessingTime()
Method Detail

bootstrap

public void bootstrap(java.util.List<IOFMessageListener> listeners)
Description copied from interface: IPktInProcessingTimeService
Creates time buckets for a set of modules to measure their performance

Specified by:
bootstrap in interface IPktInProcessingTimeService
Parameters:
listeners - The message listeners to create time buckets for

isEnabled

public boolean isEnabled()
Specified by:
isEnabled in interface IPktInProcessingTimeService

setEnabled

public void setEnabled(boolean enabled)
Specified by:
setEnabled in interface IPktInProcessingTimeService

getCtb

public CumulativeTimeBucket getCtb()
Specified by:
getCtb in interface IPktInProcessingTimeService

recordStartTimeComp

public void recordStartTimeComp(IOFMessageListener listener)
Description copied from interface: IPktInProcessingTimeService
Stores a timestamp in ns. Used right before a service handles an OF message. Only stores if the service is enabled.

Specified by:
recordStartTimeComp in interface IPktInProcessingTimeService

recordEndTimeComp

public void recordEndTimeComp(IOFMessageListener listener)
Specified by:
recordEndTimeComp in interface IPktInProcessingTimeService

recordStartTimePktIn

public void recordStartTimePktIn()
Specified by:
recordStartTimePktIn in interface IPktInProcessingTimeService

recordEndTimePktIn

public void recordEndTimePktIn(IOFSwitch sw,
                               OFMessage m,
                               FloodlightContext cntx)
Specified by:
recordEndTimePktIn in interface IPktInProcessingTimeService

getModuleServices

public java.util.Collection<java.lang.Class<? extends IFloodlightService>> getModuleServices()
Description copied from interface: IFloodlightModule
Return the list of interfaces that this module implements. All interfaces must inherit IFloodlightService

Specified by:
getModuleServices in interface IFloodlightModule
Returns:

getServiceImpls

public java.util.Map<java.lang.Class<? extends IFloodlightService>,IFloodlightService> getServiceImpls()
Description copied from interface: IFloodlightModule
Instantiate (as needed) and return objects that implement each of the services exported by this module. The map returned maps the implemented service to the object. The object could be the same object or different objects for different exported services.

Specified by:
getServiceImpls in interface IFloodlightModule
Returns:
The map from service interface class to service implementation

getModuleDependencies

public java.util.Collection<java.lang.Class<? extends IFloodlightService>> getModuleDependencies()
Description copied from interface: IFloodlightModule
Get a list of Modules that this module depends on. The module system will ensure that each these dependencies is resolved before the subsequent calls to init().

Specified by:
getModuleDependencies in interface IFloodlightModule
Returns:
The Collection of IFloodlightServices that this module depends on.

init

public void init(FloodlightModuleContext context)
          throws FloodlightModuleException
Description copied from interface: IFloodlightModule
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.

Specified by:
init in interface IFloodlightModule
Throws:
FloodlightModuleException

startUp

public void startUp(FloodlightModuleContext context)
Description copied from interface: IFloodlightModule
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.

Specified by:
startUp in interface IFloodlightModule