@@ -110,30 +110,35 @@ QString RSGraphSource::displayValue(float v) const
110110void 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.
0 commit comments