use of org.onosproject.net.statistic.PollInterval in project onos by opennetworkinglab.
the class FlowStatisticManager method loadSummaryPortInternal.
private SummaryFlowEntryWithLoad loadSummaryPortInternal(ConnectPoint cp) {
checkPermission(STATISTIC_READ);
Set<FlowEntry> currentStats;
Set<FlowEntry> previousStats;
TypedStatistics typedStatistics;
synchronized (statisticStore) {
currentStats = statisticStore.getCurrentStatistic(cp);
if (currentStats == null) {
return new SummaryFlowEntryWithLoad(cp, new DefaultLoad());
}
previousStats = statisticStore.getPreviousStatistic(cp);
if (previousStats == null) {
return new SummaryFlowEntryWithLoad(cp, new DefaultLoad());
}
// copy to local flow entry
typedStatistics = new TypedStatistics(currentStats, previousStats);
// Check for validity of this stats data
checkLoadValidity(currentStats, previousStats);
}
// current and previous set is not empty!
Set<FlowEntry> currentSet = typedStatistics.current();
Set<FlowEntry> previousSet = typedStatistics.previous();
PollInterval pollIntervalInstance = PollInterval.getInstance();
// We assume that default pollInterval is flowPollFrequency in case adaptiveFlowSampling is true or false
Load totalLoad = new DefaultLoad(aggregateBytesSet(currentSet), aggregateBytesSet(previousSet), pollIntervalInstance.getPollInterval());
Map<FlowRule, FlowEntry> currentMap;
Map<FlowRule, FlowEntry> previousMap;
currentMap = typedStatistics.currentImmediate();
previousMap = typedStatistics.previousImmediate();
Load immediateLoad = new DefaultLoad(aggregateBytesMap(currentMap), aggregateBytesMap(previousMap), pollIntervalInstance.getPollInterval());
currentMap = typedStatistics.currentShort();
previousMap = typedStatistics.previousShort();
Load shortLoad = new DefaultLoad(aggregateBytesMap(currentMap), aggregateBytesMap(previousMap), pollIntervalInstance.getPollInterval());
currentMap = typedStatistics.currentMid();
previousMap = typedStatistics.previousMid();
Load midLoad = new DefaultLoad(aggregateBytesMap(currentMap), aggregateBytesMap(previousMap), pollIntervalInstance.getMidPollInterval());
currentMap = typedStatistics.currentLong();
previousMap = typedStatistics.previousLong();
Load longLoad = new DefaultLoad(aggregateBytesMap(currentMap), aggregateBytesMap(previousMap), pollIntervalInstance.getLongPollInterval());
currentMap = typedStatistics.currentUnknown();
previousMap = typedStatistics.previousUnknown();
Load unknownLoad = new DefaultLoad(aggregateBytesMap(currentMap), aggregateBytesMap(previousMap), pollIntervalInstance.getPollInterval());
return new SummaryFlowEntryWithLoad(cp, totalLoad, immediateLoad, shortLoad, midLoad, longLoad, unknownLoad);
}
use of org.onosproject.net.statistic.PollInterval in project onos by opennetworkinglab.
the class NewAdaptiveFlowStatsCollector method initMemberVars.
// check calAndPollInterval validity and set all pollInterval values and finally initialize each task call count
private void initMemberVars(int pollInterval) {
if (pollInterval < MIN_CAL_AND_POLL_FREQUENCY) {
this.calAndPollInterval = MIN_CAL_AND_POLL_FREQUENCY;
} else if (pollInterval >= MAX_CAL_AND_POLL_FREQUENCY) {
this.calAndPollInterval = MAX_CAL_AND_POLL_FREQUENCY;
} else {
this.calAndPollInterval = pollInterval;
}
calAndPollInterval = CAL_AND_POLL_TIMES * calAndPollInterval;
midPollInterval = MID_POLL_TIMES * calAndPollInterval;
longPollInterval = LONG_POLL_TIMES * calAndPollInterval;
entirePollInterval = ENTIRE_POLL_TIMES * calAndPollInterval;
// Set the PollInterval values for statistic manager and others usage
DefaultLoad.setPollInterval(calAndPollInterval);
PollInterval pollInterval1Instance = PollInterval.getInstance();
pollInterval1Instance.setPollInterval(calAndPollInterval);
pollInterval1Instance.setMidPollInterval(midPollInterval);
pollInterval1Instance.setLongPollInterval(longPollInterval);
pollInterval1Instance.setEntirePollInterval(entirePollInterval);
callCountCalAndShortFlowsTask = 0;
callCountMidFlowsTask = 0;
callCountLongFlowsTask = 0;
flowMissingXid = NO_FLOW_MISSING_XID;
}
Aggregations