Search in sources :

Example 1 with PollInterval

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);
}
Also used : DefaultLoad(org.onosproject.net.statistic.DefaultLoad) Load(org.onosproject.net.statistic.Load) SummaryFlowEntryWithLoad(org.onosproject.net.statistic.SummaryFlowEntryWithLoad) TypedFlowEntryWithLoad(org.onosproject.net.statistic.TypedFlowEntryWithLoad) FlowEntryWithLoad(org.onosproject.net.statistic.FlowEntryWithLoad) PollInterval(org.onosproject.net.statistic.PollInterval) SummaryFlowEntryWithLoad(org.onosproject.net.statistic.SummaryFlowEntryWithLoad) FlowRule(org.onosproject.net.flow.FlowRule) FlowEntry(org.onosproject.net.flow.FlowEntry) DefaultTypedFlowEntry(org.onosproject.net.flow.DefaultTypedFlowEntry) DefaultFlowEntry(org.onosproject.net.flow.DefaultFlowEntry) TypedStoredFlowEntry(org.onosproject.net.flow.TypedStoredFlowEntry) StoredFlowEntry(org.onosproject.net.flow.StoredFlowEntry) DefaultLoad(org.onosproject.net.statistic.DefaultLoad)

Example 2 with PollInterval

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;
}
Also used : PollInterval(org.onosproject.net.statistic.PollInterval)

Aggregations

PollInterval (org.onosproject.net.statistic.PollInterval)2 DefaultFlowEntry (org.onosproject.net.flow.DefaultFlowEntry)1 DefaultTypedFlowEntry (org.onosproject.net.flow.DefaultTypedFlowEntry)1 FlowEntry (org.onosproject.net.flow.FlowEntry)1 FlowRule (org.onosproject.net.flow.FlowRule)1 StoredFlowEntry (org.onosproject.net.flow.StoredFlowEntry)1 TypedStoredFlowEntry (org.onosproject.net.flow.TypedStoredFlowEntry)1 DefaultLoad (org.onosproject.net.statistic.DefaultLoad)1 FlowEntryWithLoad (org.onosproject.net.statistic.FlowEntryWithLoad)1 Load (org.onosproject.net.statistic.Load)1 SummaryFlowEntryWithLoad (org.onosproject.net.statistic.SummaryFlowEntryWithLoad)1 TypedFlowEntryWithLoad (org.onosproject.net.statistic.TypedFlowEntryWithLoad)1