MCPcopy Create free account
hub / github.com/amule-project/amule / UpdateStatGraphs

Method UpdateStatGraphs

src/StatisticsDlg.cpp:158–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158void CStatisticsDlg::UpdateStatGraphs(const uint32 peakconnections, const GraphUpdateInfo& update)
159{
160
161 std::vector<float *> v1(3);
162 v1[0] = const_cast<float *>(&update.downloads[0]);
163 v1[1] = const_cast<float *>(&update.downloads[1]);
164 v1[2] = const_cast<float *>(&update.downloads[2]);
165 const std::vector<float *> &apfDown(v1);
166 std::vector<float *> v2(3);
167 v2[0] = const_cast<float *>(&update.uploads[0]);
168 v2[1] = const_cast<float *>(&update.uploads[1]);
169 v2[2] = const_cast<float *>(&update.uploads[2]);
170 const std::vector<float *> &apfUp(v2);
171 std::vector<float *> v3(3);
172 v3[0] = const_cast<float *>(&update.connections[0]);
173 v3[1] = const_cast<float *>(&update.connections[1]);
174 v3[2] = const_cast<float *>(&update.connections[2]);
175 const std::vector<float *> &apfConn(v3);
176
177 if (!IsShownOnScreen()) {
178 pscopeDL->DelayPoints();
179 pscopeUL->DelayPoints();
180 pscopeConn->DelayPoints();
181 }
182
183 static unsigned nScalePrev=1;
184 unsigned nScale = (unsigned)std::ceil((float)peakconnections / pscopeConn->GetUpperLimit());
185 if (nScale != nScalePrev) {
186 nScalePrev = nScale;
187 wxStaticText* label = CastChild( ID_ACTIVEC, wxStaticText );
188
189 label->SetLabel(CFormat(_("Active connections (1:%u)")) % nScale);
190 label->GetParent()->Layout();
191
192 pscopeConn->SetRange(0.0, (float)nScale*pscopeConn->GetUpperLimit(), 1);
193 }
194
195 if (!IsShownOnScreen()) {
196 return;
197 }
198
199 pscopeDL->AppendPoints(update.timestamp, apfDown);
200 pscopeUL->AppendPoints(update.timestamp, apfUp);
201 pscopeConn->AppendPoints(update.timestamp, apfConn);
202}
203
204
205void CStatisticsDlg::SetUpdatePeriod(int step)

Callers 2

HandlePacketMethod · 0.80
OnGUITimerMethod · 0.80

Calls 6

CFormatClass · 0.85
DelayPointsMethod · 0.80
GetUpperLimitMethod · 0.80
GetParentMethod · 0.80
SetRangeMethod · 0.80
AppendPointsMethod · 0.80

Tested by

no test coverage detected