22 :currentGraphRange(range),
23 currentSampleCounter(0),
41 update(nextRange, queue.takeLast() + queue.takeLast());
48 if (stashQueue.size() == 3){
49 update(nextRange, stashQueue.takeLast() + stashQueue.takeLast() + stashQueue.takeLast());
84 queue.push_front(trafficSample);
129 int i = rangeQueue.size() - 1;
132 result.push_front(rangeQueue.at(i)+ rangeQueue.at(i-1));
146 for (
int i = 0; i < stashQueue.size(); i++){
147 sum+=stashQueue.at(i);
149 int toFullSample = 3 - stashQueue.size();
150 if (toFullSample > rangeQueue.size())
154 for (
int i = 0; i < toFullSample; i++){
155 sum+=rangeQueue.at(lastUnusedSample);
160 while (lastUnusedSample - 2 >= 0){
161 result.push_front(rangeQueue.at(lastUnusedSample) + rangeQueue.at(lastUnusedSample-1) + rangeQueue.at(lastUnusedSample-2));
162 lastUnusedSample -= 3;
255 for(
auto& sample : newQueue){
void setLastBytes(quint64 nLastBytesIn, quint64 nLastBytesOut)
float converSampletoBandwith(float dataAmount)
static const int SMALLEST_SAMPLE_PERIOD
void switchRange(GraphRange newRange)
SampleQueue sumEach3Samples(const SampleQueue &rangeQueue, GraphRange range)
TrafficGraphData(GraphRange range)
SampleQueue sumEach2Samples(const SampleQueue &rangeQueue)
SampleQueueMap sampleStash
void tryUpdateNextWithLast2Samples(GraphRange range, GraphRange nextRange)
static const int RangeMinutes[]
void tryAddingSampleToStash(GraphRange range)
void tryUpdateNextWithLast3Samples(GraphRange range, GraphRange nextRange)
SampleQueue getRangeQueue(GraphRange range)
GraphRange currentGraphRange
bool update(const TrafficSample &trafficSample)
static const int DESIRED_DATA_SAMPLES
SampleQueue getCurrentRangeQueueWithAverageBandwidth()
static const int DesiredQueueSizes[]
SampleQueue getCurrentRangeQueue()
QQueue< TrafficSample > SampleQueue