MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / updateRates

Method updateRates

src/qt/trafficgraphwidget.cpp:123–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123void TrafficGraphWidget::updateRates()
124{
125 if(!clientModel) return;
126
127 quint64 bytesIn = clientModel->node().getTotalBytesRecv(),
128 bytesOut = clientModel->node().getTotalBytesSent();
129 float inRate = (bytesIn - nLastBytesIn) / 1024.0f * 1000 / timer->interval();
130 float outRate = (bytesOut - nLastBytesOut) / 1024.0f * 1000 / timer->interval();
131 vSamplesIn.push_front(inRate);
132 vSamplesOut.push_front(outRate);
133 nLastBytesIn = bytesIn;
134 nLastBytesOut = bytesOut;
135
136 while(vSamplesIn.size() > DESIRED_SAMPLES) {
137 vSamplesIn.pop_back();
138 }
139 while(vSamplesOut.size() > DESIRED_SAMPLES) {
140 vSamplesOut.pop_back();
141 }
142
143 float tmax = 0.0f;
144 for (float f : vSamplesIn) {
145 if(f > tmax) tmax = f;
146 }
147 for (float f : vSamplesOut) {
148 if(f > tmax) tmax = f;
149 }
150 fMax = tmax;
151 update();
152}
153
154void TrafficGraphWidget::setGraphRangeMins(int mins)
155{

Callers

nothing calls this directly

Calls 4

getTotalBytesRecvMethod · 0.80
getTotalBytesSentMethod · 0.80
sizeMethod · 0.45
pop_backMethod · 0.45

Tested by

no test coverage detected