diff --git a/libretroshare/src/pqi/pqi_base.h b/libretroshare/src/pqi/pqi_base.h index 30bfbc830..2f2446315 100644 --- a/libretroshare/src/pqi/pqi_base.h +++ b/libretroshare/src/pqi/pqi_base.h @@ -94,7 +94,6 @@ virtual void getRates(RsBwRates &rates) return; } - virtual int gatherOutQueueStatistics(std::vector& /*per_service_count*/,std::vector& /*per_priority_count*/) { return 0;} virtual int gatherStatistics(std::list& /* outqueue_lst */,std::list& /* inqueue_lst */) { return 0;} virtual int getQueueSize(bool /* in */) { return 0;} diff --git a/libretroshare/src/pqi/pqihandler.cc b/libretroshare/src/pqi/pqihandler.cc index c724eace3..60f23c914 100644 --- a/libretroshare/src/pqi/pqihandler.cc +++ b/libretroshare/src/pqi/pqihandler.cc @@ -387,33 +387,20 @@ RsRawItem *pqihandler::GetRsRawItem() static const float MIN_RATE = 0.01; // 10 B/s -int pqihandler::ExtractOutQueueStatistics(OutQueueStatistics& stats) -{ - stats.per_service_item_count.clear() ; - - std::vector item_counts(65536,0) ; - stats.per_priority_item_count.clear() ; - stats.per_priority_item_count.resize(10,0) ; - - std::map::iterator it; - - for(it = mods.begin(); it != mods.end(); ++it) - (it -> second)->pqi->gatherOutQueueStatistics(item_counts,stats.per_priority_item_count) ; - - for(int i=0;i<65536;++i) - if(item_counts[i] > 0) - stats.per_service_item_count[i] = item_counts[i] ; - - return 1 ; -} - int pqihandler::ExtractTrafficInfo(std::list& out_lst,std::list& in_lst) { in_lst.clear() ; out_lst.clear() ; for( std::map::iterator it = mods.begin(); it != mods.end(); ++it) - (it -> second)->pqi->gatherStatistics(out_lst,in_lst) ; + { + std::list ilst,olst ; + + (it -> second)->pqi->gatherStatistics(olst,ilst) ; + + for(std::list::const_iterator it(ilst.begin());it!=ilst.end();++it) in_lst.push_back(*it) ; + for(std::list::const_iterator it(olst.begin());it!=olst.end();++it) out_lst.push_back(*it) ; + } return 1 ; } diff --git a/libretroshare/src/pqi/pqihandler.h b/libretroshare/src/pqi/pqihandler.h index ed520d31a..63af1f131 100644 --- a/libretroshare/src/pqi/pqihandler.h +++ b/libretroshare/src/pqi/pqihandler.h @@ -78,7 +78,6 @@ class pqihandler: public P3Interface, public pqiPublisher // TESTING INTERFACE. int ExtractRates(std::map &ratemap, RsBwRates &totals); - int ExtractOutQueueStatistics(OutQueueStatistics& stats) ; int ExtractTrafficInfo(std::list &out_lst, std::list &in_lst); protected: diff --git a/libretroshare/src/pqi/pqiperson.cc b/libretroshare/src/pqi/pqiperson.cc index d9c05ed24..aa9ba4667 100644 --- a/libretroshare/src/pqi/pqiperson.cc +++ b/libretroshare/src/pqi/pqiperson.cc @@ -592,16 +592,6 @@ void pqiperson::getRates(RsBwRates &rates) return; activepqi -> getRates(rates); } -int pqiperson::gatherOutQueueStatistics(std::vector& per_service,std::vector& per_priority) -{ - RsStackMutex stack(mPersonMtx); /**** LOCK MUTEX ****/ - - // get the rate from the active one. - if ((!active) || (activepqi == NULL)) - return 0; - return activepqi -> gatherOutQueueStatistics(per_service,per_priority); -} - int pqiperson::gatherStatistics(std::list& out_lst,std::list& in_lst) { RsStackMutex stack(mPersonMtx); /**** LOCK MUTEX ****/ diff --git a/libretroshare/src/pqi/pqiperson.h b/libretroshare/src/pqi/pqiperson.h index f51362479..07c345db3 100644 --- a/libretroshare/src/pqi/pqiperson.h +++ b/libretroshare/src/pqi/pqiperson.h @@ -170,7 +170,6 @@ virtual void getRates(RsBwRates &rates); virtual float getRate(bool in); virtual void setMaxRate(bool in, float val); virtual void setRateCap(float val_in, float val_out); -virtual int gatherOutQueueStatistics(std::vector& per_service,std::vector& per_priority); virtual int gatherStatistics(std::list& outqueue_lst,std::list& inqueue_lst) ; diff --git a/libretroshare/src/pqi/pqistreamer.cc b/libretroshare/src/pqi/pqistreamer.cc index 295f58d2c..f77884321 100644 --- a/libretroshare/src/pqi/pqistreamer.cc +++ b/libretroshare/src/pqi/pqistreamer.cc @@ -1024,15 +1024,6 @@ void pqistreamer::free_rpend_locked() mPkt_rpend_size = 0; } -int pqistreamer::gatherOutQueueStatistics(std::vector& per_service_count,std::vector& per_priority_count) -{ -#ifdef TO_REMOVE - RsStackMutex stack(mStreamerMtx); /**** LOCKED MUTEX ****/ - - return locked_gatherStatistics(per_service_count,per_priority_count); -#endif -} - int pqistreamer::gatherStatistics(std::list& outqueue_lst,std::list& inqueue_lst) { RsStackMutex stack(mStreamerMtx); /**** LOCKED MUTEX ****/ diff --git a/libretroshare/src/pqi/pqistreamer.h b/libretroshare/src/pqi/pqistreamer.h index 9c56023d9..37d352a64 100644 --- a/libretroshare/src/pqi/pqistreamer.h +++ b/libretroshare/src/pqi/pqistreamer.h @@ -62,7 +62,6 @@ class pqistreamer: public PQInterface time_t getLastIncomingTS(); // Time of last data packet, for checking a connection is alive. virtual void getRates(RsBwRates &rates); virtual int getQueueSize(bool in); // extracting data. - virtual int gatherOutQueueStatistics(std::vector& per_service_count,std::vector& per_priority_count); // extracting data. virtual int gatherStatistics(std::list& outqueue_stats,std::list& inqueue_stats); // extracting data. protected: diff --git a/libretroshare/src/retroshare/rsconfig.h b/libretroshare/src/retroshare/rsconfig.h index 3a4aea695..f967a01fc 100644 --- a/libretroshare/src/retroshare/rsconfig.h +++ b/libretroshare/src/retroshare/rsconfig.h @@ -186,13 +186,6 @@ public: RSTrafficClue& operator+=(const RSTrafficClue& tc) { size += tc.size; count += tc.count ; return *this ;} }; -class OutQueueStatistics -{ - public: - std::map per_service_item_count ; - std::vector per_priority_item_count ; -}; - class RsConfigNetStatus { public: @@ -261,7 +254,6 @@ public: virtual int getTotalBandwidthRates(RsConfigDataRates &rates) = 0; virtual int getAllBandwidthRates(std::map &ratemap) = 0; - virtual int getOutQueueStatistics(OutQueueStatistics& stats) = 0 ; virtual int getTrafficInfo(std::list& out_lst,std::list& in_lst) = 0 ; /* From RsInit */ diff --git a/libretroshare/src/rsserver/p3serverconfig.cc b/libretroshare/src/rsserver/p3serverconfig.cc index ff4cfac0c..b34471de3 100644 --- a/libretroshare/src/rsserver/p3serverconfig.cc +++ b/libretroshare/src/rsserver/p3serverconfig.cc @@ -207,13 +207,6 @@ int p3ServerConfig::getTotalBandwidthRates(RsConfigDataRates &rates) return 0; } -int p3ServerConfig::getOutQueueStatistics(OutQueueStatistics& stats) -{ - if (rsBandwidthControl) - return rsBandwidthControl->ExtractOutQueueStatistics(stats); - else - return 0; -} int p3ServerConfig::getAllBandwidthRates(std::map &ratemap) { if (rsBandwidthControl) diff --git a/libretroshare/src/rsserver/p3serverconfig.h b/libretroshare/src/rsserver/p3serverconfig.h index 60be56237..d9ce3eaed 100644 --- a/libretroshare/src/rsserver/p3serverconfig.h +++ b/libretroshare/src/rsserver/p3serverconfig.h @@ -58,7 +58,6 @@ virtual int getConfigStartup(RsConfigStartup ¶ms); virtual int getTotalBandwidthRates(RsConfigDataRates &rates); virtual int getAllBandwidthRates(std::map &ratemap); - virtual int getOutQueueStatistics(OutQueueStatistics& stats) ; virtual int getTrafficInfo(std::list& out_lst, std::list &in_lst) ; /* From RsInit */ diff --git a/libretroshare/src/services/p3bwctrl.cc b/libretroshare/src/services/p3bwctrl.cc index 8f583e926..17fef32c7 100644 --- a/libretroshare/src/services/p3bwctrl.cc +++ b/libretroshare/src/services/p3bwctrl.cc @@ -280,11 +280,6 @@ int p3BandwidthControl::getAllBandwidthRates(std::mapExtractOutQueueStatistics(stats) ; -} - int p3BandwidthControl::ExtractTrafficInfo(std::list& in_stats,std::list& out_stats) { return mPg->ExtractTrafficInfo(out_stats,in_stats) ; diff --git a/retroshare-gui/src/gui/common/RSGraphWidget.cpp b/retroshare-gui/src/gui/common/RSGraphWidget.cpp index a079efad3..97af9b1f9 100644 --- a/retroshare-gui/src/gui/common/RSGraphWidget.cpp +++ b/retroshare-gui/src/gui/common/RSGraphWidget.cpp @@ -414,6 +414,8 @@ void RSGraphWidget::pointsFromData(const std::vector& values,QVector& values,QVector= SCALE_WIDTH *fact&& last_px < SCALE_WIDTH*fact) + if(px >= SCALE_WIDTH*fact && last_px < SCALE_WIDTH*fact) { float alpha = (SCALE_WIDTH*fact - last_px)/(px - last_px) ; float ipx = SCALE_WIDTH*fact ; @@ -433,10 +435,12 @@ void RSGraphWidget::pointsFromData(const std::vector& values,QVector& values,QVector 1 && points[points.size()-2].y() == points.back().y() && points.back().y() == py) points.pop_back() ; +// if(fabs(px - last_px)/_time_scale > min_x_no_data_threshold) +// { +// points << QPointF(last_px,y) ; +// points << QPointF(px,y) ; +// } + points << QPointF(px,py) ; if(i==values.size()-1) points << QPointF(px,y) ; + + last_px = px ; + last_py = py ; + } } diff --git a/retroshare-gui/src/gui/statistics/BWGraph.cpp b/retroshare-gui/src/gui/statistics/BWGraph.cpp index bd7b0e345..3ec24071f 100644 --- a/retroshare-gui/src/gui/statistics/BWGraph.cpp +++ b/retroshare-gui/src/gui/statistics/BWGraph.cpp @@ -1,6 +1,9 @@ #include "BWGraph.h" #include +#include +#include "retroshare/rsservicecontrol.h" +#include "retroshare/rspeers.h" //#define BWGRAPH_DEBUG 1 @@ -23,20 +26,35 @@ void BWGraphSource::update() thc.time_stamp = getTime() ; mTrafficHistory.push_back(thc) ; + std::set fds ; + // add visible friends/services for(std::list::const_iterator it(thc.out_rstcl.begin());it!=thc.out_rstcl.end();++it) { - mVisibleFriends.insert(it->peer_id) ; + fds.insert(it->peer_id) ; mVisibleServices.insert(it->service_id) ; } for(std::list::const_iterator it(thc.in_rstcl.begin());it!=thc.in_rstcl.end();++it) { - mVisibleFriends.insert(it->peer_id) ; + fds.insert(it->peer_id) ; mVisibleServices.insert(it->service_id) ; } + for(std::set::const_iterator it(fds.begin());it!=fds.end();++it) + { + std::string& s(mVisibleFriends[*it]) ; + + if(s.empty()) + { + RsPeerDetails pd ; + rsPeers->getPeerDetails(*it,pd) ; + + s = pd.name + " (" + pd.location + ")" ; + } + } + #ifdef BWGRAPH_DEBUG std::cerr << " visible friends: " << std::dec << mVisibleFriends.size() << std::endl; std::cerr << " visible service: " << std::dec << mVisibleServices.size() << std::endl; @@ -49,12 +67,25 @@ void BWGraphSource::update() qint64 ms = getTime() ; + std::set unused_vals ; + + for(std::map > >::const_iterator it=_points.begin();it!=_points.end();++it) + unused_vals.insert(it->first) ; + for(std::map::iterator it=vals.begin();it!=vals.end();++it) { std::list >& lst(_points[it->first]) ; + if(!lst.empty() && fabsf(lst.back().first - ms) > _update_period_msecs*1.2 ) + { + lst.push_back(std::make_pair(lst.back().first,0)) ; + lst.push_back(std::make_pair( ms,0)) ; + } + lst.push_back(std::make_pair(ms,it->second)) ; + unused_vals.erase(it->first) ; + for(std::list >::iterator it2=lst.begin();it2!=lst.end();) if( ms - (*it2).first > _time_limit_msecs) { @@ -65,6 +96,11 @@ void BWGraphSource::update() break ; } + // make sure that all values are fed. + + for(std::set::const_iterator it(unused_vals.begin());it!=unused_vals.end();++it) + _points[*it].push_back(std::make_pair(ms,0)) ; + // remove empty lists for(std::map > >::iterator it=_points.begin();it!=_points.end();) @@ -122,7 +158,7 @@ void BWGraphSource::convertTrafficClueToValues(const std::list& l for(uint32_t i=0;i<256;++i) if(clue_per_sub_id[i].count > 0) - vals[QString::number(i,16).toStdString()] = (_current_unit == UNIT_KILOBYTES)?(clue_per_sub_id[i].size/1000.0f):(clue_per_sub_id[i].count) ; + vals["item #"+QString::number(i,16).toStdString()] = (_current_unit == UNIT_KILOBYTES)?(clue_per_sub_id[i].size):(clue_per_sub_id[i].count) ; } break ; @@ -135,7 +171,7 @@ void BWGraphSource::convertTrafficClueToValues(const std::list& l clue_per_id[it->service_id] += *it ; for(std::map::const_iterator it(clue_per_id.begin());it!=clue_per_id.end();++it) - vals[QString::number(it->first,16).toStdString()] = (_current_unit == UNIT_KILOBYTES)?(it->second.size/1000.0f):(it->second.count) ; + vals[mServiceInfoMap[it->first].mServiceName] = (_current_unit == UNIT_KILOBYTES)?(it->second.size):(it->second.count) ; } break ; case GRAPH_TYPE_SUM: // single friend, sum services => one curve @@ -147,7 +183,7 @@ void BWGraphSource::convertTrafficClueToValues(const std::list& l if(it->peer_id == _current_selected_friend) total += *it ; - vals[_current_selected_friend_name] = (_current_unit == UNIT_KILOBYTES)?(total.size/1000.0f):(total.count) ; + vals[visibleFriendName(_current_selected_friend)] = (_current_unit == UNIT_KILOBYTES)?(total.size):(total.count) ; } } break ; @@ -164,7 +200,7 @@ void BWGraphSource::convertTrafficClueToValues(const std::list& l clue_per_peer_id[it->peer_id] += *it ; for(std::map::const_iterator it(clue_per_peer_id.begin());it!=clue_per_peer_id.end();++it) - vals[it->first.toStdString()] = (_current_unit == UNIT_KILOBYTES)?(it->second.size/1000.0f):(it->second.count) ; + vals[visibleFriendName(it->first)] = (_current_unit == UNIT_KILOBYTES)?(it->second.size):(it->second.count) ; } break ; @@ -178,7 +214,7 @@ void BWGraphSource::convertTrafficClueToValues(const std::list& l clue_per_peer_id[it->peer_id] += *it; for(std::map::const_iterator it(clue_per_peer_id.begin());it!=clue_per_peer_id.end();++it) - vals[it->first.toStdString()] = (_current_unit == UNIT_KILOBYTES)?(it->second.size/1000.0f):(it->second.count) ; + vals[visibleFriendName(it->first)] = (_current_unit == UNIT_KILOBYTES)?(it->second.size):(it->second.count) ; } break ; } @@ -197,7 +233,7 @@ void BWGraphSource::convertTrafficClueToValues(const std::list& l for(uint32_t i=0;i<256;++i) if(clue_per_sub_id[i].count > 0) - vals[QString::number(i,16).toStdString()] = (_current_unit == UNIT_KILOBYTES)?(clue_per_sub_id[i].size/1000.0f):(clue_per_sub_id[i].count) ; + vals["item #"+QString::number(i,16).toStdString()] = (_current_unit == UNIT_KILOBYTES)?(clue_per_sub_id[i].size):(clue_per_sub_id[i].count) ; } break ; @@ -209,7 +245,7 @@ void BWGraphSource::convertTrafficClueToValues(const std::list& l clue_per_service[it->service_id] += *it; for(std::map::const_iterator it(clue_per_service.begin());it!=clue_per_service.end();++it) - vals[QString::number(it->first,16).toStdString()] = (_current_unit == UNIT_KILOBYTES)?(it->second.size/1000.0f):(it->second.count) ; + vals[mServiceInfoMap[it->first].mServiceName] = (_current_unit == UNIT_KILOBYTES)?(it->second.size):(it->second.count) ; } break ; @@ -220,7 +256,7 @@ void BWGraphSource::convertTrafficClueToValues(const std::list& l for(std::list::const_iterator it(lst.begin());it!=lst.end();++it) total += *it; - vals[QString("Total").toStdString()] = (_current_unit == UNIT_KILOBYTES)?(total.size/1000.0f):(total.count) ; + vals[QString("Total").toStdString()] = (_current_unit == UNIT_KILOBYTES)?(total.size):(total.count) ; } break ; } @@ -228,6 +264,16 @@ void BWGraphSource::convertTrafficClueToValues(const std::list& l } } +std::string BWGraphSource::visibleFriendName(const RsPeerId& pid) const +{ + std::map::const_iterator it = mVisibleFriends.find(pid) ; + + if(it != mVisibleFriends.end()) + return it->second; + else + return std::string("[unknown]") ; +} + BWGraphSource::BWGraphSource() : RSGraphSource() { @@ -243,6 +289,11 @@ BWGraphSource::BWGraphSource() _current_unit = UNIT_KILOBYTES; _current_direction = DIRECTION_UP; + RsPeerServiceInfo rspsi ; + rsServiceControl->getOwnServices(rspsi) ; + + for(std::map::const_iterator it(rspsi.mServiceList.begin());it!=rspsi.mServiceList.end();++it) + mServiceInfoMap[ (it->first >> 8) & 0xffff ] = it->second ; } void BWGraphSource::getValues(std::map& values) const @@ -259,6 +310,27 @@ void BWGraphSource::getValues(std::map& values) const QString BWGraphSource::unitName() const { return (_current_unit == UNIT_KILOBYTES)?tr("KB/s"):QString(); } +//QString BWGraphSource::displayName(int i) const +//{ +// int n=0; +// for(std::map > >::const_iterator it = _points.begin();it!=_points.end() ;++it) +// if(n++ == i) +// { +// // find out what is displayed +// +// if(_service_graph_type == GRAPH_TYPE_SINGLE ) +// if(_friend_graph_type != GRAPH_TYPE_ALL) +// return QString::fromStdString(it->first) ;// sub item +// else +// return QString::fromStdString(mVisibleFriends[RsPeerId(it->first)]) ;// peer id item +// else +// +// +// } +// +// return QString("[error]"); +//} + QString BWGraphSource::displayValue(float v) const { if(_current_unit == UNIT_KILOBYTES) @@ -285,10 +357,7 @@ QString BWGraphSource::displayValue(float v) const QString BWGraphSource::legend(int i,float v) const { - if(i==0) - return RSGraphSource::legend(i,v) + " Total: " + niceNumber(_total_recv) ; - else - return RSGraphSource::legend(i,v) + " Total: " + niceNumber(_total_sent) ; + return RSGraphSource::legend(i,v) ;//+ " Total: " + niceNumber(_total_recv) ; } QString BWGraphSource::niceNumber(float v) const { @@ -304,7 +373,9 @@ QString BWGraphSource::niceNumber(float v) const void BWGraphSource::setSelector(int selector_type,int graph_type,const std::string& selector_client_string) { +#ifdef BWGRAPH_DEBUG std::cerr << "Setting Graph Source selector to " << selector_type << " - " << graph_type << " - " << selector_client_string << std::endl; +#endif bool changed = false ; @@ -382,27 +453,42 @@ void BWGraphSource::setDirection(int dir) } void BWGraphSource::recomputeCurrentCurves() { +#ifdef BWGRAPH_DEBUG std::cerr << "BWGraphSource: recomputing current curves." << std::endl; +#endif _points.clear() ; // now, convert data to current curve points. + std::set used_values_ref ; + for(std::list::const_iterator it(mTrafficHistory.begin());it!=mTrafficHistory.end();++it) { std::map vals ; qint64 ms = (*it).time_stamp ; + std::set unused_values = used_values_ref ; + if(_current_direction==DIRECTION_UP) convertTrafficClueToValues((*it).out_rstcl,vals) ; else convertTrafficClueToValues((*it).in_rstcl,vals) ; for(std::map::iterator it2=vals.begin();it2!=vals.end();++it2) + { _points[it2->first].push_back(std::make_pair(ms,it2->second)) ; + used_values_ref.insert(it2->first) ; + unused_values.erase(it2->first) ; + } + + for(std::set::const_iterator it(unused_values.begin());it!=unused_values.end();++it) + _points[*it].push_back(std::make_pair(ms,0)) ; } +#ifdef BWGRAPH_DEBUG std::cerr << " points() contains " << _points.size() << " curves." << std::endl; +#endif } BWGraph::BWGraph(QWidget *parent) : RSGraphWidget(parent) diff --git a/retroshare-gui/src/gui/statistics/BWGraph.h b/retroshare-gui/src/gui/statistics/BWGraph.h index ce9f52981..dbab1ed14 100644 --- a/retroshare-gui/src/gui/statistics/BWGraph.h +++ b/retroshare-gui/src/gui/statistics/BWGraph.h @@ -1,6 +1,7 @@ #pragma once #include "retroshare/rsconfig.h" +#include "retroshare/rsservicecontrol.h" #include class BWGraphSource: public RSGraphSource @@ -24,6 +25,7 @@ public: virtual void getValues(std::map& values) const; virtual QString displayValue(float v) const; +// virtual QString displayName(int i) const; virtual QString legend(int i,float v) const; virtual void update(); QString unitName() const ; @@ -39,12 +41,13 @@ public: int friendGraphType() const { return _friend_graph_type ;} int serviceGraphType() const { return _service_graph_type ;} - const std::set& visibleFriends() const { return mVisibleFriends; } + const std::map& visibleFriends() const { return mVisibleFriends; } const std::set& visibleServices() const { return mVisibleServices; } protected: void convertTrafficClueToValues(const std::list &lst, std::map &vals) const; void recomputeCurrentCurves() ; + std::string visibleFriendName(const RsPeerId &pid) const ; private: QString niceNumber(float v) const; @@ -56,15 +59,16 @@ private: int _service_graph_type ; RsPeerId _current_selected_friend ; - std::string _current_selected_friend_name ; uint16_t _current_selected_service ; int _current_unit ; int _current_direction ; std::list mTrafficHistory ; - std::set mVisibleFriends ; + std::map mVisibleFriends ; std::set mVisibleServices ; + + mutable std::map mServiceInfoMap ; }; class BWGraph: public RSGraphWidget @@ -74,7 +78,7 @@ class BWGraph: public RSGraphWidget BWGraphSource *source() ; - const std::set& visibleFriends() const { return _local_source->visibleFriends(); } + const std::map& visibleFriends() const { return _local_source->visibleFriends(); } const std::set& visibleServices() const { return _local_source->visibleServices(); } protected: BWGraphSource *_local_source ; diff --git a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp index be0349403..5d411c120 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp +++ b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp @@ -2,6 +2,7 @@ #include #include "retroshare/rspeers.h" +#include "retroshare/rsservicecontrol.h" #include "util/RsProtectedTimer.h" #include "retroshare-gui/RsAutoUpdatePage.h" #include "BandwidthStatsWidget.h" @@ -52,23 +53,23 @@ void BandwidthStatsWidget::updateComboBoxes() // Setup button/combobox info uint32_t indx = 2 ; - RsPeerDetails details ; + //RsPeerDetails details ; RsPeerId current_friend_id(ui.friend_CB->itemData(ui.friend_CB->currentIndex()).toString().toStdString()) ; - for(std::set::const_iterator it(ui.bwgraph_BW->visibleFriends().begin());it!=ui.bwgraph_BW->visibleFriends().end();++it) + for(std::map::const_iterator it(ui.bwgraph_BW->visibleFriends().begin());it!=ui.bwgraph_BW->visibleFriends().end();++it) { - if( (*it).toStdString() != ui.friend_CB->itemData(indx).toString().toStdString()) + if( it->first.toStdString() != ui.friend_CB->itemData(indx).toString().toStdString()) { - std::cerr << " friends: " << *it << " not in combo at place " << indx << ". Adding it." << std::endl; + std::cerr << " friends: " << it->first << " not in combo at place " << indx << ". Adding it." << std::endl; - QString name = "[Unknown]" ; + QString name = QString::fromUtf8(it->second.c_str()) ; QVariant data ; - if(rsPeers->getPeerDetails(*it,details)) - { - name = QString::fromUtf8(details.name.c_str())+" ("+QString::fromUtf8(details.location.c_str())+")" ; - data = QVariant(QString::fromStdString( (*it).toStdString())) ; - } + //if(rsPeers->getPeerDetails(*it,details)) + //{ + // name = QString::fromUtf8(details.name.c_str())+" ("+QString::fromUtf8(details.location.c_str())+")" ; + data = QVariant(QString::fromStdString( (it->first).toStdString())) ; + //} if(ui.friend_CB->count() <= indx) ui.friend_CB->addItem(name,data) ; @@ -78,7 +79,7 @@ void BandwidthStatsWidget::updateComboBoxes() ui.friend_CB->setItemData(indx,data) ; } - if(current_friend_id == *it && ui.friend_CB->currentIndex() != indx) + if(current_friend_id == it->first && ui.friend_CB->currentIndex() != indx) ui.friend_CB->setCurrentIndex(indx) ; } ++indx ; @@ -92,6 +93,9 @@ void BandwidthStatsWidget::updateComboBoxes() // now one entry per service + RsPeerServiceInfo service_info_map ; + rsServiceControl->getOwnServices(service_info_map) ; + indx = 2 ; uint16_t current_service_id = ui.service_CB->itemData(ui.service_CB->currentIndex()).toInt() ; @@ -99,13 +103,13 @@ void BandwidthStatsWidget::updateComboBoxes() { if(*it != ui.service_CB->itemData(indx).toInt()) { - std::cerr << " services: " << std::hex << *it << std::dec << " not in combo at place " << indx << ". Adding it." << std::endl; + QString sname = QString::fromUtf8(service_info_map.mServiceList[ ((*it)<<8) + 0x02000000].mServiceName.c_str()) ; if(ui.service_CB->count() <= indx) - ui.service_CB->addItem(QString::number(*it,16),QVariant(*it)) ; + ui.service_CB->addItem(sname + " (0x"+QString::number(*it,16)+")",QVariant(*it)) ; else { - ui.service_CB->setItemText(indx,QString::number(*it,16)) ; + ui.service_CB->setItemText(indx,sname + " (0x"+QString::number(*it,16)+")") ; ui.service_CB->setItemData(indx,QVariant(*it)) ; } diff --git a/retroshare-gui/src/gui/statistics/BwCtrlWindow.cpp b/retroshare-gui/src/gui/statistics/BwCtrlWindow.cpp index 1a0a4d1cf..45d5da8c6 100644 --- a/retroshare-gui/src/gui/statistics/BwCtrlWindow.cpp +++ b/retroshare-gui/src/gui/statistics/BwCtrlWindow.cpp @@ -220,11 +220,6 @@ void BwCtrlWindow::updateDisplay() } updateBandwidth(); - - OutQueueStatistics stats ; - rsConfig->getOutQueueStatistics(stats) ; - - //_outqueue_stats_W->updateStatistics(stats) ; } void BwCtrlWindow::updateBandwidth() diff --git a/retroshare-gui/src/gui/statistics/OutQueueStatistics.cpp b/retroshare-gui/src/gui/statistics/OutQueueStatistics.cpp index 9985d5cf9..fe8b4579f 100644 --- a/retroshare-gui/src/gui/statistics/OutQueueStatistics.cpp +++ b/retroshare-gui/src/gui/statistics/OutQueueStatistics.cpp @@ -35,7 +35,7 @@ static QString serviceName(uint16_t s) case /* RS_SERVICE_TYPE_BWCTRL */ 0x0021: return QString("BdwCtrl") ; case /* RS_SERVICE_TYPE_BANLIST */ 0x0101: return QString("BanList") ; case /* RS_SERVICE_TYPE_STATUS */ 0x0102: return QString("Status") ; - case /* RS_SERVICE_TYPE_NXS */ 0x0200: return QString("Nxs") ; + case /* RS_SERVICE_TYPE_NXS */ 0x0200: return QString("Nxs") ; case /* RS_SERVICE_GXS_TYPE_GXSID */ 0x0211: return QString("Gxs Ids") ; case /* RS_SERVICE_GXS_TYPE_PHOTO */ 0x0212: return QString("Gxs Photo") ; case /* RS_SERVICE_GXS_TYPE_WIKI */ 0x0213: return QString("Gxs Wiki") ; diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index 8492d8ab6..ec9517108 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -363,7 +363,6 @@ HEADERS += rshare.h \ gui/statistics/StatisticsWindow.h \ gui/statistics/BwCtrlWindow.h \ gui/statistics/RttStatistics.h \ - gui/statistics/OutQueueStatistics.h \ gui/FileTransfer/TransferUserNotify.h \ gui/plugins/PluginInterface.h \ gui/im_history/ImHistoryBrowser.h \ @@ -892,7 +891,6 @@ SOURCES += main.cpp \ gui/statistics/TurtleRouterDialog.cpp \ gui/statistics/TurtleRouterStatistics.cpp \ gui/statistics/GlobalRouterStatistics.cpp \ - gui/statistics/OutQueueStatistics.cpp \ gui/statistics/StatisticsWindow.cpp \ gui/statistics/BwCtrlWindow.cpp \ gui/statistics/RttStatistics.cpp \