Skip to content

Commit fb90a3a

Browse files
committed
fixed data collection problem
1 parent 5c68c50 commit fb90a3a

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

retroshare-gui/src/gui/common/RSGraphWidget.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,30 +110,35 @@ QString RSGraphSource::displayValue(float v) const
110110
void RSGraphSource::getSlicedValues(uint min_secs_ago,uint max_secs_ago,std::vector<float>& vals) const
111111
{
112112
vals.clear();
113-
uint64_t max_ts = max_secs_ago*1000; // in _points the TS are w.r.t. now (in reverse) and in ms.
114-
uint64_t min_ts = min_secs_ago*1000;
115113

116-
std::cerr << "Collecting data between ts = " << min_ts << " and " << max_ts << std::endl;
117114
std::vector<std::pair<ZeroInitFloat,ZeroInitInt>> collected_vals;
118115

119-
for(const auto& lst:_points)
116+
for(auto lst_it = _points.begin();lst_it!=_points.end();++lst_it)
120117
{
121-
collected_vals.push_back(std::make_pair(0,0)); // init so that the value is mentionned in the list.
118+
collected_vals.push_back(std::make_pair(0.,0)); // init so that the value is mentionned in the list.
122119
auto& v(collected_vals.back());
123120

124-
std::cerr << " points string: \"" << lst.first << "\"" << std::endl;
121+
uint64_t max_ts = lst_it->second.back().first - min_secs_ago*1000; // in _points the TS are w.r.t. now (in reverse) and in ms.
122+
uint64_t min_ts = lst_it->second.back().first - max_secs_ago*1000;
125123

126-
for(const auto& p:lst.second)
124+
std::cerr << "Collecting data in \"" << lst_it->first << "\" between ts = " << min_ts << " and " << max_ts << std::endl;
125+
126+
for(const auto& p:lst_it->second)
127127
{
128+
std::cerr << " TS = " << p.first ;
129+
std::cerr << " data \"" << lst_it->first << "\": Found ts = " << p.first << ": value " << p.second ;
130+
128131
if((uint64_t)p.first >= min_ts && (uint64_t)p.first <= max_ts)
129132
{
130133
v.first.v += p.second;
131134
v.second.v++;
132135

133-
std::cerr << " TS = " << p.first ;
134-
std::cerr << " data \"" << lst.first << "\": Found ts = " << p.first << ": adding." << std::endl;
136+
std::cerr << " Kept."<< std::endl;
135137
}
138+
else
139+
std::cerr << std::endl;
136140
}
141+
std::cerr << " total value = " << v.first.v << " -- " << v.second.v << std::endl;
137142
}
138143

139144
// now average values when multiple values have been collected.

retroshare-gui/src/gui/statistics/BWGraph.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
void BWGraphSource::update()
3131
{
32-
#ifdef BWGRAPH_DEBUG
32+
#ifndef BWGRAPH_DEBUG
3333
std::cerr << "Updating BW graphsource..." << std::endl;
3434
#endif
3535

@@ -44,7 +44,7 @@ void BWGraphSource::update()
4444
auto& t = tmap[PeerSrvSubsrv(c)];
4545
t.cumulated_size += c.size;
4646
t.cumulated_count += c.count;
47-
#ifdef BWGRAPH_DEBUG
47+
#ifndef BWGRAPH_DEBUG
4848
std::cerr << "Pushing " << c.TS << " " << c.peer_id << " " << c.service_id << " " << (int)c.service_sub_id << " into cumulated map" << std::endl;
4949
#endif
5050
}

0 commit comments

Comments
 (0)