added debug code for testing time gap history

This commit is contained in:
wangyix 2014-06-19 14:54:22 -07:00
parent aa3602f0fb
commit 8176aa1292
2 changed files with 8 additions and 2 deletions

View file

@ -38,6 +38,8 @@ void InterframeTimeGapHistory::frameReceived() {
if (_lastFrameReceivedTime != 0) {
quint64 gap = now - _lastFrameReceivedTime;
printf("new gap: %llu\n", gap);
// update the current interval max
if (gap > _currentIntervalMaxGap) {
_currentIntervalMaxGap = gap;
@ -47,6 +49,8 @@ void InterframeTimeGapHistory::frameReceived() {
// if the current interval of samples is now full, record it in our interval maxes
if (_numSamplesInCurrentInterval == TIME_GAP_NUM_SAMPLES_IN_INTERVAL) {
printf("\t interval full: max interval gap: %llu\n", _currentIntervalMaxGap);
// find location to insert this interval's max (increment index cyclically)
_newestIntervalMaxGapAt = _newestIntervalMaxGapAt == TIME_GAP_NUM_INTERVALS_IN_WINDOW - 1 ? 0 : _newestIntervalMaxGapAt + 1;
@ -62,6 +66,8 @@ void InterframeTimeGapHistory::frameReceived() {
}
_newWindowMaxGapAvailable = true;
printf("\t\t new window max gap: %llu\n", _windowMaxGap);
// reset the current interval
_numSamplesInCurrentInterval = 0;
_currentIntervalMaxGap = 0;

View file

@ -22,8 +22,8 @@
#include "NodeData.h"
// this means that every 500 samples, the max for the past 10*500 samples will be calculated
const int TIME_GAP_NUM_SAMPLES_IN_INTERVAL = 500;
const int TIME_GAP_NUM_INTERVALS_IN_WINDOW = 10;
const int TIME_GAP_NUM_SAMPLES_IN_INTERVAL = 6;
const int TIME_GAP_NUM_INTERVALS_IN_WINDOW = 4;
class InterframeTimeGapHistory {
public: