void SequenceNumberStats::reset() { _missingSet.clear(); _stats = PacketStreamStats(); _lastSenderID = NULL_LOCAL_ID; _statsHistory.clear(); _lastUnreasonableSequence = 0; _consecutiveUnreasonableOnTime = 0; }
PacketStreamStats SequenceNumberStats::getStatsForLastHistoryInterval() const { const PacketStreamStats* newestStats = _statsHistory.getNewestEntry(); const PacketStreamStats* secondNewestStats = _statsHistory.get(1); // this catches cases where history is length 1 or 0 (both are NULL in case of 0) if (newestStats == NULL || secondNewestStats == NULL) { return PacketStreamStats(); } return *newestStats - *secondNewestStats; }
PacketStreamStats SequenceNumberStats::getStatsForHistoryWindow() const { const PacketStreamStats* newestStats = _statsHistory.getNewestEntry(); const PacketStreamStats* oldestStats = _statsHistory.get(_statsHistory.getNumEntries() - 1); // this catches cases where history is length 1 or 0 (both are NULL in case of 0) if (newestStats == oldestStats) { return PacketStreamStats(); } // calculate difference between newest stats and oldest stats to get window stats return *newestStats - *oldestStats; }
PacketStreamStats SequenceNumberStats::getStatsForHistoryWindow() const { const PacketStreamStats* newestStats = _statsHistory.getNewestEntry(); const PacketStreamStats* oldestStats = _statsHistory.get(_statsHistory.getNumEntries() - 1); // this catches cases where history is length 1 or 0 (both are NULL in case of 0) if (newestStats == oldestStats) { return PacketStreamStats(); } // calculate difference between newest stats and oldest stats to get window stats PacketStreamStats windowStats; windowStats._numReceived = newestStats->_numReceived - oldestStats->_numReceived; windowStats._numUnreasonable = newestStats->_numUnreasonable - oldestStats->_numUnreasonable; windowStats._numEarly = newestStats->_numEarly - oldestStats->_numEarly; windowStats._numLate = newestStats->_numLate - oldestStats->_numLate; windowStats._numLost = newestStats->_numLost - oldestStats->_numLost; windowStats._numRecovered = newestStats->_numRecovered - oldestStats->_numRecovered; windowStats._numDuplicate = newestStats->_numDuplicate - oldestStats->_numDuplicate; return windowStats; }
void SequenceNumberStats::reset() { _missingSet.clear(); _stats = PacketStreamStats(); _statsHistory.clear(); }