added infrastructure for gathering statistics about GxsTransport. Unfinished.

This commit is contained in:
csoler 2017-05-21 15:57:10 +02:00
parent b341fea170
commit fbeb6ff98d
9 changed files with 741 additions and 12 deletions

View file

@ -31,6 +31,11 @@ p3GxsTrans::~p3GxsTrans()
} }
} }
bool p3GxsTrans::getStatistics(GxsTransStatistics& stats)
{
stats.prefered_group_id = mPreferredGroupId;
}
bool p3GxsTrans::sendMail( RsGxsTransId& mailId, bool p3GxsTrans::sendMail( RsGxsTransId& mailId,
GxsTransSubServices service, GxsTransSubServices service,
const RsGxsId& own_gxsid, const RsGxsId& recipient, const RsGxsId& own_gxsid, const RsGxsId& recipient,
@ -120,9 +125,9 @@ void p3GxsTrans::handleResponse(uint32_t token, uint32_t req_type)
&& meta.mGroupId != mPreferredGroupId; && meta.mGroupId != mPreferredGroupId;
if(shoudlSubscribe) if(shoudlSubscribe)
subscribeToGroup(token, meta.mGroupId, true); RsGenExchange::subscribeToGroup(token, meta.mGroupId, true);
else if(shoudlUnSubscribe) else if(shoudlUnSubscribe)
subscribeToGroup(token, meta.mGroupId, false); RsGenExchange::subscribeToGroup(token, meta.mGroupId, false);
#ifdef GXS_MAIL_GRP_DEBUG #ifdef GXS_MAIL_GRP_DEBUG
char buff[30]; char buff[30];
@ -337,7 +342,7 @@ void p3GxsTrans::notifyChanges(std::vector<RsGxsNotify*>& changes)
std::cout << "p3GxsTrans::notifyChanges(...) msgChange" << std::endl; std::cout << "p3GxsTrans::notifyChanges(...) msgChange" << std::endl;
uint32_t token; uint32_t token;
RsTokReqOptions opts; opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA; RsTokReqOptions opts; opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
getTokenService()->requestMsgInfo( token, 0xcaca, RsGenExchange::getTokenService()->requestMsgInfo( token, 0xcaca,
opts, msgChange->msgChangeMap ); opts, msgChange->msgChangeMap );
GxsTokenQueue::queueRequest(token, MAILS_UPDATE); GxsTokenQueue::queueRequest(token, MAILS_UPDATE);
@ -393,8 +398,8 @@ bool p3GxsTrans::requestGroupsData(const std::list<RsGxsGroupId>* groupIds)
// std::cout << "p3GxsTrans::requestGroupsList()" << std::endl; // std::cout << "p3GxsTrans::requestGroupsList()" << std::endl;
uint32_t token; uint32_t token;
RsTokReqOptions opts; opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA; RsTokReqOptions opts; opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
if(!groupIds) getTokenService()->requestGroupInfo(token, 0xcaca, opts); if(!groupIds) RsGenExchange::getTokenService()->requestGroupInfo(token, 0xcaca, opts);
else getTokenService()->requestGroupInfo(token, 0xcaca, opts, *groupIds); else RsGenExchange::getTokenService()->requestGroupInfo(token, 0xcaca, opts, *groupIds);
GxsTokenQueue::queueRequest(token, GROUPS_LIST); GxsTokenQueue::queueRequest(token, GROUPS_LIST);
return true; return true;
} }

View file

@ -26,6 +26,7 @@
#include "gxstrans/p3gxstransitems.h" #include "gxstrans/p3gxstransitems.h"
#include "services/p3idservice.h" // For p3IdService #include "services/p3idservice.h" // For p3IdService
#include "util/rsthreads.h" #include "util/rsthreads.h"
#include "retroshare/rsgxstrans.h"
struct p3GxsTrans; struct p3GxsTrans;
@ -76,18 +77,32 @@ struct GxsTransClient
* @see GxsTransClient::receiveGxsTransMail(...), * @see GxsTransClient::receiveGxsTransMail(...),
* @see GxsTransClient::notifyGxsTransSendStatus(...). * @see GxsTransClient::notifyGxsTransSendStatus(...).
*/ */
struct p3GxsTrans : RsGenExchange, GxsTokenQueue, p3Config class p3GxsTrans : public RsGenExchange, public GxsTokenQueue, public p3Config, public RsGxsTrans
{ {
public:
p3GxsTrans( RsGeneralDataService* gds, RsNetworkExchangeService* nes, p3GxsTrans( RsGeneralDataService* gds, RsNetworkExchangeService* nes,
p3IdService& identities ) : p3IdService& identities ) :
RsGenExchange( gds, nes, new RsGxsTransSerializer(), RsGenExchange( gds, nes, new RsGxsTransSerializer(),
RS_SERVICE_TYPE_GXS_TRANS, &identities, RS_SERVICE_TYPE_GXS_TRANS, &identities,
AuthenPolicy(), GXS_STORAGE_PERIOD ), AuthenPolicy(), GXS_STORAGE_PERIOD ),
GxsTokenQueue(this), mIdService(identities), GxsTokenQueue(this),
RsGxsTrans(this),
mIdService(identities),
mServClientsMutex("p3GxsTrans client services map mutex"), mServClientsMutex("p3GxsTrans client services map mutex"),
mOutgoingMutex("p3GxsTrans outgoing queue map mutex"), mOutgoingMutex("p3GxsTrans outgoing queue map mutex"),
mIngoingMutex("p3GxsTrans ingoing queue map mutex") {} mIngoingMutex("p3GxsTrans ingoing queue map mutex") {}
~p3GxsTrans();
virtual ~p3GxsTrans();
/*!
* \brief getStatistics
* Gathers all sorts of statistics about the internals of p3GxsTrans, in order to display info about the running status,
* message transport, etc.
* \param stats This structure contains all statistics information.
* \return true is the call succeeds.
*/
virtual bool getStatistics(GxsTransStatistics& stats);
/** /**
* Send an email to recipient, in the process author of the email is * Send an email to recipient, in the process author of the email is

View file

@ -0,0 +1,42 @@
#include "retroshare/rstokenservice.h"
#include "retroshare/rsgxsifacehelper.h"
#include "retroshare/rsgxscommon.h"
class RsGxsTransGroup
{
public:
RsGroupMetaData mMeta;
};
class RsGxsTransMsg
{
public:
RsGxsTransMsg() : size(0),data(NULL) {}
virtual ~RsGxsTransMsg() { free(data) ; }
public:
RsMsgMetaData mMeta;
uint32_t size ;
uint8_t *data ;
};
class RsGxsTrans: public RsGxsIfaceHelper
{
public:
struct GxsTransStatistics
{
RsGxsGroupId prefered_group_id ;
};
RsGxsTrans(RsGxsIface *gxs) : RsGxsIfaceHelper(gxs) {}
virtual ~RsGxsTrans() {}
virtual bool getStatistics(GxsTransStatistics& stats)=0;
// virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsTransGroup> &groups) = 0;
// virtual bool getPostData(const uint32_t &token, std::vector<RsGxsTransMsg> &posts) = 0;
};
extern RsGxsTrans *rsgxstrans ;

View file

@ -0,0 +1,454 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 20011, RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <iostream>
#include <QTimer>
#include <QObject>
#include <QFontMetrics>
#include <QWheelEvent>
#include <time.h>
#include <QMenu>
#include <QPainter>
#include <QStylePainter>
#include <QLayout>
#include <QHeaderView>
#include <retroshare/rsgxstrans.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsidentity.h>
#include "GxsTransportStatistics.h"
#include "gui/Identity/IdDetailsDialog.h"
#include "gui/settings/rsharesettings.h"
#include "util/QtVersion.h"
#include "util/misc.h"
#define COL_ID 0
#define COL_NICKNAME 1
#define COL_DESTINATION 2
#define COL_DATASTATUS 3
#define COL_TUNNELSTATUS 4
#define COL_DATASIZE 5
#define COL_DATAHASH 6
#define COL_RECEIVED 7
#define COL_SEND 8
#define COL_DUPLICATION_FACTOR 9
static const int PARTIAL_VIEW_SIZE = 9 ;
static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ;
static QColor colorScale(float f)
{
if(f == 0)
return QColor::fromHsv(0,0,192) ;
else
return QColor::fromHsv((int)((1.0-f)*280),200,255) ;
}
GxsTransportStatistics::GxsTransportStatistics(QWidget *parent)
: RsAutoUpdatePage(2000,parent)
{
setupUi(this) ;
m_bProcessSettings = false;
_router_F->setWidget( _tst_CW = new GxsTransportStatisticsWidget() ) ;
/* Set header resize modes and initial section sizes Uploads TreeView*/
QHeaderView_setSectionResizeMode(treeWidget->header(), QHeaderView::ResizeToContents);
connect(treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(CustomPopupMenu(QPoint)));
// load settings
processSettings(true);
}
GxsTransportStatistics::~GxsTransportStatistics()
{
// save settings
processSettings(false);
}
void GxsTransportStatistics::processSettings(bool bLoad)
{
m_bProcessSettings = true;
Settings->beginGroup(QString("GxsTransportStatistics"));
if (bLoad) {
// load settings
// state of splitter
//splitter->restoreState(Settings->value("Splitter").toByteArray());
} else {
// save settings
// state of splitter
//Settings->setValue("Splitter", splitter->saveState());
}
Settings->endGroup();
m_bProcessSettings = false;
}
void GxsTransportStatistics::CustomPopupMenu( QPoint )
{
QMenu contextMnu( this );
QTreeWidgetItem *item = treeWidget->currentItem();
if (item) {
contextMnu.addAction(QIcon(":/images/info16.png"), tr("Details"), this, SLOT(personDetails()));
}
contextMnu.exec(QCursor::pos());
}
void GxsTransportStatistics::updateDisplay()
{
_tst_CW->updateContent() ;
updateContent();
}
QString GxsTransportStatistics::getPeerName(const RsPeerId &peer_id)
{
static std::map<RsPeerId, QString> names ;
std::map<RsPeerId,QString>::const_iterator it = names.find(peer_id) ;
if( it != names.end())
return it->second ;
else
{
RsPeerDetails detail ;
if(!rsPeers->getPeerDetails(peer_id,detail))
return tr("Unknown Peer");
return (names[peer_id] = QString::fromUtf8(detail.name.c_str())) ;
}
}
void GxsTransportStatistics::updateContent()
{
std::vector<RsGRouter::GRouterRoutingCacheInfo> cache_infos ;
rsGRouter->getRoutingCacheInfo(cache_infos) ;
treeWidget->clear();
static const QString data_status_string[6] = { "Unkown","Pending","Sent","Receipt OK","Ongoing","Done" } ;
static const QString tunnel_status_string[4] = { "Unmanaged", "Pending", "Ready" } ;
time_t now = time(NULL) ;
groupBox->setTitle(tr("Pending packets")+": " + QString::number(cache_infos.size()) );
for(uint32_t i=0;i<cache_infos.size();++i)
{
QTreeWidgetItem *item = new QTreeWidgetItem();
treeWidget->addTopLevelItem(item);
RsIdentityDetails details ;
rsIdentity->getIdDetails(cache_infos[i].destination,details);
QString nicknames = QString::fromUtf8(details.mNickname.c_str());
if(nicknames.isEmpty())
nicknames = tr("Unknown");
item -> setData(COL_ID, Qt::DisplayRole, QString::number(cache_infos[i].mid,16).rightJustified(16,'0'));
item -> setData(COL_NICKNAME, Qt::DisplayRole, nicknames ) ;
item -> setData(COL_DESTINATION, Qt::DisplayRole, QString::fromStdString(cache_infos[i].destination.toStdString()));
item -> setData(COL_DATASTATUS, Qt::DisplayRole, data_status_string[cache_infos[i].data_status % 6]);
item -> setData(COL_TUNNELSTATUS, Qt::DisplayRole, tunnel_status_string[cache_infos[i].tunnel_status % 3]);
item -> setData(COL_DATASIZE, Qt::DisplayRole, misc::friendlyUnit(cache_infos[i].data_size));
item -> setData(COL_DATAHASH, Qt::DisplayRole, QString::fromStdString(cache_infos[i].item_hash.toStdString()));
item -> setData(COL_RECEIVED, Qt::DisplayRole, QString::number(now - cache_infos[i].routing_time));
item -> setData(COL_SEND, Qt::DisplayRole, QString::number(now - cache_infos[i].last_sent_time));
item -> setData(COL_DUPLICATION_FACTOR, Qt::DisplayRole, QString::number(cache_infos[i].duplication_factor));
}
}
void GxsTransportStatistics::personDetails()
{
QTreeWidgetItem *item = treeWidget->currentItem();
std::string id = item->text(COL_DESTINATION).toStdString();
if (id.empty()) {
return;
}
IdDetailsDialog *dialog = new IdDetailsDialog(RsGxsGroupId(id));
dialog->show();
}
GxsTransportStatisticsWidget::GxsTransportStatisticsWidget(QWidget *parent)
: QWidget(parent)
{
float size = QFontMetricsF(font()).height() ;
float fact = size/14.0 ;
maxWidth = 400*fact ;
maxHeight = 0 ;
mCurrentN = PARTIAL_VIEW_SIZE/2+1 ;
}
void GxsTransportStatisticsWidget::updateContent()
{
RsGRouter::GRouterRoutingMatrixInfo matrix_info ;
rsGRouter->getRoutingMatrixInfo(matrix_info) ;
mNumberOfKnownKeys = matrix_info.per_friend_probabilities.size() ;
float size = QFontMetricsF(font()).height() ;
float fact = size/14.0 ;
// What do we need to draw?
//
// Routing matrix
// Key [][][][][][][][][][]
//
// -> each [] shows a square (one per friend node) that is the routing probabilities for all connected friends
// computed using the "computeRoutingProbabilitites()" method.
//
// Own key ids
// key service id description
//
// Data items
// Msg id Local origin Destination Time Status
//
QPixmap tmppixmap(maxWidth, maxHeight);
tmppixmap.fill(Qt::transparent);
setFixedHeight(maxHeight);
QPainter painter(&tmppixmap);
painter.initFrom(this);
painter.setPen(QColor::fromRgb(0,0,0)) ;
QFont times_f(font());//"Times") ;
QFont monospace_f("Monospace") ;
monospace_f.setStyleHint(QFont::TypeWriter) ;
monospace_f.setPointSize(font().pointSize()) ;
QFontMetricsF fm_monospace(monospace_f) ;
QFontMetricsF fm_times(times_f) ;
static const int cellx = fm_monospace.width(QString(" ")) ;
static const int celly = fm_monospace.height() ;
maxHeight = 500*fact ;
// std::cerr << "Drawing into pixmap of size " << maxWidth << "x" << maxHeight << std::endl;
// draw...
int ox=5*fact,oy=5*fact ;
painter.setFont(times_f) ;
painter.drawText(ox,oy+celly,tr("Managed keys")+":" + QString::number(matrix_info.published_keys.size())) ; oy += celly*2 ;
painter.setFont(monospace_f) ;
for(std::map<Sha1CheckSum,RsGRouter::GRouterPublishedKeyInfo>::const_iterator it(matrix_info.published_keys.begin());it!=matrix_info.published_keys.end();++it)
{
QString packet_string ;
packet_string += QString::fromStdString(it->second.authentication_key.toStdString()) ;
packet_string += tr(" : Service ID =")+" "+QString::number(it->second.service_id,16) ;
packet_string += " \""+QString::fromUtf8(it->second.description_string.c_str()) + "\"" ;
painter.drawText(ox+2*cellx,oy+celly,packet_string ) ; oy += celly ;
}
oy += celly ;
std::map<QString, std::vector<QString> > tos ;
// Now draw the matrix
QString prob_string ;
painter.setFont(times_f) ;
QString Q = tr("Routing matrix (") ;
painter.drawText(ox+0*cellx,oy+fm_times.height(),Q) ;
// draw scale
for(int i=0;i<100*fact;++i)
{
painter.setPen(colorScale(i/100.0/fact)) ;
painter.drawLine(ox+fm_times.width(Q)+i,oy+fm_times.height()*0.5,ox+fm_times.width(Q)+i,oy+fm_times.height()) ;
}
painter.setPen(QColor::fromRgb(0,0,0)) ;
painter.drawText(ox+fm_times.width(Q) + 102*fact,oy+celly,")") ;
oy += celly ;
oy += celly ;
// //print friends in the same order their prob is shown
// QString FO = tr("Friend Order (");
// RsPeerDetails peer_ssl_details;
// for(uint32_t i=0;i<matrix_info.friend_ids.size();++i){
// rsPeers->getPeerDetails(matrix_info.friend_ids[i], peer_ssl_details);
// QString fn = QString::fromUtf8(peer_ssl_details.name.c_str());
// FO+=fn;
// FO+=" ";
//
// }
// FO+=")";
//
// painter.drawText(ox+0*cellx,oy+fm_times.height(),FO) ;
// oy += celly ;
// oy += celly ;
//static const int MaxKeySize = 20*fact ;
painter.setFont(monospace_f) ;
int n=0;
QString ids;
std::vector<float> current_probs ;
int current_oy = 0 ;
mMinWheelZoneX = ox+2*cellx ;
mMinWheelZoneY = oy ;
RsGxsId current_id ;
float current_width=0 ;
for(std::map<GRouterKeyId,std::vector<float> >::const_iterator it(matrix_info.per_friend_probabilities.begin());it!=matrix_info.per_friend_probabilities.end();++it,++n)
if(n >= mCurrentN-PARTIAL_VIEW_SIZE/2 && n <= mCurrentN+PARTIAL_VIEW_SIZE/2)
{
//bool is_null = false ;
//for(uint32_t i=0;i<matrix_info.friend_ids.size();++i)
// if(it->second[i] > 0.0)
// is_null = false ;
//if(!is_null)
//{
ids = QString::fromStdString(it->first.toStdString())+" : " ;
painter.drawText(ox+2*cellx,oy+celly,ids) ;
for(uint32_t i=0;i<matrix_info.friend_ids.size();++i)
painter.fillRect(ox+i*cellx+fm_monospace.width(ids),oy+0.15*celly,cellx,celly,colorScale(it->second[i])) ;
if(n == mCurrentN)
{
current_probs = it->second ;
current_oy = oy ;
current_id = it->first ;
current_width = ox+matrix_info.friend_ids.size()*cellx+fm_monospace.width(ids);
}
oy += celly ;
//}
}
mMaxWheelZoneX = ox+matrix_info.friend_ids.size()*cellx + fm_monospace.width(ids);
RsIdentityDetails iddetails ;
if(rsIdentity->getIdDetails(current_id,iddetails))
painter.drawText(current_width+cellx, current_oy+celly, QString::fromUtf8(iddetails.mNickname.c_str())) ;
else
painter.drawText(current_width+cellx, current_oy+celly, tr("[Unknown identity]")) ;
mMaxWheelZoneY = oy+celly ;
painter.setPen(QColor::fromRgb(0,0,0)) ;
painter.setPen(QColor::fromRgb(127,127,127));
painter.drawRect(ox+2*cellx,current_oy+0.15*celly,fm_monospace.width(ids)+cellx*matrix_info.friend_ids.size()- 2*cellx,celly) ;
float total_length = (matrix_info.friend_ids.size()+2)*cellx ;
if(!current_probs.empty())
for(uint32_t i=0;i<matrix_info.friend_ids.size();++i)
{
float x1 = ox+(i+0.5)*cellx+fm_monospace.width(ids) ;
float y1 = oy+0.15*celly ;
float y2 = y1+(matrix_info.friend_ids.size()-1-i+1)*celly;
RsPeerDetails peer_ssl_details;
rsPeers->getPeerDetails(matrix_info.friend_ids[i], peer_ssl_details);
painter.drawLine(x1,y1,x1,y2);
painter.drawLine(x1,y2,x1 + total_length - i*cellx,y2) ;
painter.drawText(cellx+ x1 + total_length - i*cellx,y2+(0.35)*celly, QString::fromUtf8(peer_ssl_details.name.c_str()) + " - " + QString::fromUtf8(peer_ssl_details.location.c_str()) + " ("+QString::number(current_probs[i])+")");
}
oy += celly * (2+matrix_info.friend_ids.size());
oy += celly ;
oy += celly ;
// update the pixmap
//
pixmap = tmppixmap;
maxHeight = oy ;
}
void GxsTransportStatisticsWidget::wheelEvent(QWheelEvent *e)
{
if(e->x() < mMinWheelZoneX || e->x() > mMaxWheelZoneX || e->y() < mMinWheelZoneY || e->y() > mMaxWheelZoneY)
{
QWidget::wheelEvent(e) ;
return ;
}
if(e->delta() < 0 && mCurrentN+PARTIAL_VIEW_SIZE/2+1 < mNumberOfKnownKeys)
mCurrentN++ ;
if(e->delta() > 0 && mCurrentN > PARTIAL_VIEW_SIZE/2+1)
mCurrentN-- ;
updateContent();
update();
}
QString GxsTransportStatisticsWidget::speedString(float f)
{
if(f < 1.0f)
return QString("0 B/s") ;
if(f < 1024.0f)
return QString::number((int)f)+" B/s" ;
return QString::number(f/1024.0,'f',2) + " KB/s";
}
void GxsTransportStatisticsWidget::paintEvent(QPaintEvent */*event*/)
{
QStylePainter(this).drawPixmap(0, 0, pixmap);
}
void GxsTransportStatisticsWidget::resizeEvent(QResizeEvent *event)
{
QRect TaskGraphRect = geometry();
maxWidth = TaskGraphRect.width();
maxHeight = TaskGraphRect.height() ;
QWidget::resizeEvent(event);
updateContent();
}

View file

@ -0,0 +1,86 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 20011, RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#pragma once
#include <QPoint>
#include <retroshare/rsgrouter.h>
#include <retroshare/rstypes.h>
#include "RsAutoUpdatePage.h"
#include "ui_GxsTransportStatistics.h"
class GxsTransportStatisticsWidget ;
class GxsTransportStatistics: public RsAutoUpdatePage, public Ui::GxsTransportStatistics
{
Q_OBJECT
public:
GxsTransportStatistics(QWidget *parent = NULL) ;
~GxsTransportStatistics();
// Cache for peer names.
static QString getPeerName(const RsPeerId& peer_id) ;
void updateContent() ;
private slots:
/** Create the context popup menu and it's submenus */
void CustomPopupMenu( QPoint point );
void personDetails();
private:
void processSettings(bool bLoad);
bool m_bProcessSettings;
virtual void updateDisplay() ;
GxsTransportStatisticsWidget *_tst_CW ;
} ;
class GxsTransportStatisticsWidget: public QWidget
{
Q_OBJECT
public:
GxsTransportStatisticsWidget(QWidget *parent = NULL) ;
virtual void paintEvent(QPaintEvent *event) ;
virtual void resizeEvent(QResizeEvent *event);
virtual void wheelEvent(QWheelEvent *event);
void updateContent() ;
private:
static QString speedString(float f) ;
QPixmap pixmap ;
int maxWidth,maxHeight ;
int mCurrentN ;
int mNumberOfKnownKeys ;
int mMinWheelZoneX ;
int mMinWheelZoneY ;
int mMaxWheelZoneX ;
int mMaxWheelZoneY ;
};

View file

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GxsTransportStatistics</class>
<widget class="QWidget" name="GxsTransportStatistics">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1468</width>
<height>659</height>
</rect>
</property>
<property name="windowTitle">
<string>Router Statistics</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QScrollArea" name="_router_F">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1432</width>
<height>305</height>
</rect>
</property>
</widget>
</widget>
</widget>
</item>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>GroupBox</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QTreeWidget" name="treeWidget">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>ID</string>
</property>
</column>
<column>
<property name="text">
<string>Identity Name</string>
</property>
</column>
<column>
<property name="text">
<string>Destinaton</string>
</property>
</column>
<column>
<property name="text">
<string>Data status</string>
</property>
</column>
<column>
<property name="text">
<string>Tunnel status</string>
</property>
</column>
<column>
<property name="text">
<string>Stored data size</string>
</property>
</column>
<column>
<property name="text">
<string>Data hash</string>
</property>
</column>
<column>
<property name="text">
<string>Receive time (secs ago)</string>
</property>
</column>
<column>
<property name="text">
<string>Sending time (secs ago)</string>
</property>
</column>
<column>
<property name="text">
<string>Branching factor</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -36,6 +36,7 @@
#include <gui/statistics/TurtleRouterStatistics.h> #include <gui/statistics/TurtleRouterStatistics.h>
#include <gui/statistics/GlobalRouterStatistics.h> #include <gui/statistics/GlobalRouterStatistics.h>
#include <gui/statistics/GxsTransportStatistics.h>
#include <gui/statistics/BwCtrlWindow.h> #include <gui/statistics/BwCtrlWindow.h>
#include <gui/statistics/DhtWindow.h> #include <gui/statistics/DhtWindow.h>
@ -50,10 +51,10 @@
#define IMAGE_DHT ":/images/dht32.png" #define IMAGE_DHT ":/images/dht32.png"
#define IMAGE_TURTLE ":images/turtle.png" #define IMAGE_TURTLE ":images/turtle.png"
#define IMAGE_BWGRAPH ":/images/ksysguard.png" #define IMAGE_BWGRAPH ":/images/ksysguard.png"
#define IMAGE_GLOBALROUTER ":/images/network32.png" #define IMAGE_GLOBALROUTER ":/images/network32.png"
#define IMAGE_BANDWIDTH ":images/office-chart-area-stacked.png" #define IMAGE_BANDWIDTH ":images/office-chart-area-stacked.png"
#define IMAGE_RTT ":images/office-chart-line.png" #define IMAGE_RTT ":images/office-chart-line.png"
/********************************************** STATIC WINDOW *************************************/ /********************************************** STATIC WINDOW *************************************/
StatisticsWindow * StatisticsWindow::mInstance = NULL; StatisticsWindow * StatisticsWindow::mInstance = NULL;
@ -133,6 +134,9 @@ void StatisticsWindow::initStackedPage()
ui->stackPages->add(grsdlg = new GlobalRouterStatistics(ui->stackPages), ui->stackPages->add(grsdlg = new GlobalRouterStatistics(ui->stackPages),
action = createPageAction(QIcon(IMAGE_GLOBALROUTER), tr("Global Router"), grp)); action = createPageAction(QIcon(IMAGE_GLOBALROUTER), tr("Global Router"), grp));
ui->stackPages->add(gxsdlg = new GxsTransportStatistics(ui->stackPages),
action = createPageAction(QIcon(IMAGE_GLOBALROUTER), tr("Gxs Transport"), grp));
ui->stackPages->add(rttdlg = new RttStatistics(ui->stackPages), ui->stackPages->add(rttdlg = new RttStatistics(ui->stackPages),
action = createPageAction(QIcon(IMAGE_RTT), tr("RTT Statistics"), grp)); action = createPageAction(QIcon(IMAGE_RTT), tr("RTT Statistics"), grp));

View file

@ -37,6 +37,7 @@ class DhtWindow;
class BwCtrlWindow; class BwCtrlWindow;
class TurtleRouterStatistics; class TurtleRouterStatistics;
class GlobalRouterStatistics; class GlobalRouterStatistics;
class GxsTransportStatistics;
class RttStatistics; class RttStatistics;
class StatisticsWindow : public QMainWindow { class StatisticsWindow : public QMainWindow {
@ -53,6 +54,7 @@ public:
DhtWindow *dhtw; DhtWindow *dhtw;
GlobalRouterStatistics *grsdlg; GlobalRouterStatistics *grsdlg;
GxsTransportStatistics *gxsdlg;
BwCtrlWindow *bwdlg; BwCtrlWindow *bwdlg;
TurtleRouterStatistics *trsdlg; TurtleRouterStatistics *trsdlg;
RttStatistics *rttdlg; RttStatistics *rttdlg;

View file

@ -374,6 +374,7 @@ HEADERS += rshare.h \
gui/statistics/BandwidthStatsWidget.h \ gui/statistics/BandwidthStatsWidget.h \
gui/statistics/DhtWindow.h \ gui/statistics/DhtWindow.h \
gui/statistics/GlobalRouterStatistics.h \ gui/statistics/GlobalRouterStatistics.h \
gui/statistics/GxsTransportStatistics.h \
gui/statistics/StatisticsWindow.h \ gui/statistics/StatisticsWindow.h \
gui/statistics/BwCtrlWindow.h \ gui/statistics/BwCtrlWindow.h \
gui/statistics/RttStatistics.h \ gui/statistics/RttStatistics.h \
@ -680,6 +681,7 @@ FORMS += gui/StartDialog.ui \
gui/statistics/TurtleRouterDialog.ui \ gui/statistics/TurtleRouterDialog.ui \
gui/statistics/TurtleRouterStatistics.ui \ gui/statistics/TurtleRouterStatistics.ui \
gui/statistics/GlobalRouterStatistics.ui \ gui/statistics/GlobalRouterStatistics.ui \
gui/statistics/GxsTransportStatistics.ui \
gui/statistics/StatisticsWindow.ui \ gui/statistics/StatisticsWindow.ui \
gui/statistics/BwCtrlWindow.ui \ gui/statistics/BwCtrlWindow.ui \
gui/statistics/RttStatistics.ui \ gui/statistics/RttStatistics.ui \
@ -917,6 +919,7 @@ SOURCES += main.cpp \
gui/statistics/TurtleRouterDialog.cpp \ gui/statistics/TurtleRouterDialog.cpp \
gui/statistics/TurtleRouterStatistics.cpp \ gui/statistics/TurtleRouterStatistics.cpp \
gui/statistics/GlobalRouterStatistics.cpp \ gui/statistics/GlobalRouterStatistics.cpp \
gui/statistics/GxsTransportStatistics.cpp \
gui/statistics/StatisticsWindow.cpp \ gui/statistics/StatisticsWindow.cpp \
gui/statistics/BwCtrlWindow.cpp \ gui/statistics/BwCtrlWindow.cpp \
gui/statistics/RttStatistics.cpp \ gui/statistics/RttStatistics.cpp \