public final class StatisticsCounters extends Object implements StatisticsHandler
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_LOG_REPORT_PERIOD
Default delay between two writings into log (milliseconds).
|
static int |
MINIMAL_LOG_REPORT_PERIOD
Minimal delay between two writings into log (milliseconds).
|
Modifier and Type | Method and Description |
---|---|
Counter |
getCounter(CounterEventTypes counterEventKey)
Get counter by CounterEventType.
|
protected Map<CounterEventTypes,Counter> |
getCountersMap()
Returns the countersMap.
|
protected CounterEventTypes[] |
getEnabledCounters()
Returns the enabled counters.
|
static StatisticsCounters |
getInstance()
Get instance of statistics counters, first created object does not start counting and log reporting.
|
int |
getLogReportPeriod()
Returns the current delay between two writings into logs.
|
void |
incrementCounter(CounterEventTypes counterEventKey)
Increment value of given counter.
|
boolean |
isCounterEnabled(CounterEventTypes counterEventKey)
Determines if the given counter is enabled.
|
boolean |
isRunCounting()
Give an information if counting is running.
|
boolean |
isRunLogReport()
Give an information if log reporter is running (statistics are write into logs).
|
String |
printStatistics()
Returns statistics.
|
void |
resetCounters()
Resets all counters.
|
void |
startCounting(boolean reportToLogs,
int logReportDelay)
Start counting (counters are set to 0 before counting starts).
|
void |
startLogReport(int logReportDelay)
Prints statistics with given delay between logs.
|
void |
stopCounting()
Stop counting, values in counters are untouched, log reporter is stopped.
|
void |
stopLogReport()
Stops logging, counting continues.
|
public static final int DEFAULT_LOG_REPORT_PERIOD
public static final int MINIMAL_LOG_REPORT_PERIOD
public static StatisticsCounters getInstance()
public void startCounting(boolean reportToLogs, int logReportDelay)
reportToLogs
- - true = statistic counters will periodically loglogReportDelay
- - delay between two logs (in milliseconds)public void stopCounting()
public boolean isRunCounting()
public void startLogReport(int logReportDelay)
logReportDelay
- - delay between two logs (in milliseconds)IllegalArgumentException
- if logReportDelay is less than 0public void stopLogReport()
public boolean isRunLogReport()
public int getLogReportPeriod()
protected CounterEventTypes[] getEnabledCounters()
protected Map<CounterEventTypes,Counter> getCountersMap()
public boolean isCounterEnabled(CounterEventTypes counterEventKey)
counterEventKey
- the counter keypublic Counter getCounter(CounterEventTypes counterEventKey)
counterEventKey
- key to identify counter (can not be null)IllegalArgumentException
- if counterEventKey is nullpublic void incrementCounter(CounterEventTypes counterEventKey)
counterEventKey
- key to identify counterpublic void resetCounters()
StatisticsHandler
resetCounters
in interface StatisticsHandler
public String printStatistics()
StatisticsHandler
printStatistics
in interface StatisticsHandler
Copyright © 2020 OpenDaylight. All rights reserved.