Class StatisticsCounters
java.lang.Object
org.opendaylight.openflowjava.statistics.StatisticsCounters
- All Implemented Interfaces:
- StatisticsHandler
Singleton class to hold and process counters.
- Author:
- madamjak
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intDefault delay between two writings into log (milliseconds).static final intMinimal delay between two writings into log (milliseconds).
- 
Method SummaryModifier and TypeMethodDescriptiongetCounter(CounterEventTypes counterEventKey) Get counter by CounterEventType.protected Map<CounterEventTypes,Counter> Returns the countersMap.protected CounterEventTypes[]Returns the enabled counters.static StatisticsCountersGet instance of statistics counters, first created object does not start counting and log reporting.intReturns the current delay between two writings into logs.voidincrementCounter(CounterEventTypes counterEventKey) Increment value of given counter.booleanisCounterEnabled(CounterEventTypes counterEventKey) Determines if the given counter is enabled.booleanGive an information if counting is running.booleanGive an information if log reporter is running (statistics are write into logs).Returns statistics.voidResets all counters.voidstartCounting(boolean reportToLogs, int logReportDelay) Start counting (counters are set to 0 before counting starts).voidstartLogReport(int logReportDelay) Prints statistics with given delay between logs.voidStop counting, values in counters are untouched, log reporter is stopped.voidStops logging, counting continues.
- 
Field Details- 
DEFAULT_LOG_REPORT_PERIODpublic static final int DEFAULT_LOG_REPORT_PERIODDefault delay between two writings into log (milliseconds).- See Also:
 
- 
MINIMAL_LOG_REPORT_PERIODpublic static final int MINIMAL_LOG_REPORT_PERIODMinimal delay between two writings into log (milliseconds).- See Also:
 
 
- 
- 
Method Details- 
getInstanceGet instance of statistics counters, first created object does not start counting and log reporting.- Returns:
- an instance
 
- 
startCountingpublic void startCounting(boolean reportToLogs, int logReportDelay) Start counting (counters are set to 0 before counting starts).- Parameters:
- reportToLogs- - true = statistic counters will periodically log
- logReportDelay- - delay between two logs (in milliseconds)
 
- 
stopCountingpublic void stopCounting()Stop counting, values in counters are untouched, log reporter is stopped.
- 
isRunCountingpublic boolean isRunCounting()Give an information if counting is running.- Returns:
- true, if counting is running, otherwise false
 
- 
startLogReportpublic void startLogReport(int logReportDelay) Prints statistics with given delay between logs.- Parameters:
- logReportDelay- - delay between two logs (in milliseconds)
- Throws:
- IllegalArgumentException- if logReportDelay is less than 0
 
- 
stopLogReportpublic void stopLogReport()Stops logging, counting continues.
- 
isRunLogReportpublic boolean isRunLogReport()Give an information if log reporter is running (statistics are write into logs).- Returns:
- true if log reporter writes statistics into log, otherwise false
 
- 
getLogReportPeriodpublic int getLogReportPeriod()Returns the current delay between two writings into logs.
- 
getEnabledCountersReturns the enabled counters.
- 
getCountersMapReturns the countersMap.
- 
isCounterEnabledDetermines if the given counter is enabled.- Parameters:
- counterEventKey- the counter key
- Returns:
- true if counter has been Enabled, otherwise false
 
- 
getCounterGet counter by CounterEventType.- Parameters:
- counterEventKey- key to identify counter (can not be null)
- Returns:
- Counter object or null if counter has not been enabled
- Throws:
- IllegalArgumentException- if counterEventKey is null
 
- 
incrementCounterIncrement value of given counter.- Parameters:
- counterEventKey- key to identify counter
 
- 
resetCounterspublic void resetCounters()Description copied from interface:StatisticsHandlerResets all counters.- Specified by:
- resetCountersin interface- StatisticsHandler
 
- 
printStatisticsDescription copied from interface:StatisticsHandlerReturns statistics.- Specified by:
- printStatisticsin interface- StatisticsHandler
 
 
-