* Disable RTT display by default.

* flipped RTT horizontal axis, and added "New" and "Old" Indicators.
 * only consider visible points for maxRTT (vertical scale) of plot.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4526 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2011-08-04 15:01:11 +00:00
parent 3623b3d957
commit a9bdb5119f
2 changed files with 31 additions and 14 deletions

View File

@ -41,7 +41,6 @@
#include "FileTransferInfoWidget.h"
#include "TurtleRouterDialog.h"
#include "TurtleRouterStatistics.h"
#include "VoipStatistics.h"
#include "xprogressbar.h"
#include "settings/rsharesettings.h"
@ -50,6 +49,14 @@
#include <retroshare/rsdisc.h>
#include "util/misc.h"
/****
* #define SHOW_RTT_STATISTICS 1
****/
#ifdef SHOW_RTT_STATISTICS
#include "VoipStatistics.h"
#endif
/* Images for context menu icons */
#define IMAGE_INFO ":/images/fileinfo.png"
#define IMAGE_CANCEL ":/images/delete.png"
@ -268,7 +275,9 @@ TransfersDialog::TransfersDialog(QWidget *parent)
ui.tabWidget->addTab( new TurtleRouterDialog(), tr("Router Requests")) ;
#ifdef SHOW_RTT_STATISTICS
ui.tabWidget->addTab( new VoipStatistics(), tr("RTT Statistics")) ;
#endif
// TurtleRouterDialog *trdl = new TurtleRouterDialog();

View File

@ -36,11 +36,13 @@
#define PLOT_HEIGHT 100
#define PLOT_WIDTH 500
#define MAX_DISPLAY_PERIOD 300
double convertDtToPixels(double refTs, double minTs, double ts)
{
double dt = refTs - ts;
double maxdt = refTs - minTs;
double pix = dt / maxdt * PLOT_WIDTH;
double pix = PLOT_WIDTH - dt / maxdt * PLOT_WIDTH;
return pix;
}
@ -88,9 +90,6 @@ class VoipLagPlot
return ;
double maxdt = mRefTS - mMinTS;
#define MAX_DISPLAY_PERIOD 300
if (maxdt > MAX_DISPLAY_PERIOD)
{
mMinTS = mRefTS - MAX_DISPLAY_PERIOD;
@ -143,12 +142,15 @@ class VoipLagPlot
}
painter->setPen(QColor::fromRgb(0,0,0)) ;
painter->drawText(ox+PLOT_WIDTH + cellx ,oy + celly / 2, QString::number(mMaxRTT) + " secs") ;
painter->drawText(ox+PLOT_WIDTH + cellx ,oy + celly / 2, QString::number(mMaxRTT)+" "+QObject::tr("secs")) ;
oy += PLOT_HEIGHT / 2;
painter->drawText(ox+PLOT_WIDTH + cellx ,oy + celly / 2, QString::number(mMaxRTT / 2.0) + " secs") ;
painter->drawText(ox+PLOT_WIDTH + cellx ,oy + celly / 2, QString::number(mMaxRTT / 2.0)+" "+QObject::tr("secs")) ;
oy += PLOT_HEIGHT / 2;
painter->drawText(ox+PLOT_WIDTH + cellx ,oy + celly / 2, QString::number(0.0) + " secs") ;
oy += 2 * celly;
painter->drawText(ox+PLOT_WIDTH + cellx ,oy + celly / 2, QString::number(0.0)+" "+QObject::tr("secs")) ;
oy += celly;
painter->drawText(ox ,oy, QObject::tr("Old"));
painter->drawText(ox + PLOT_WIDTH - cellx ,oy, QObject::tr("Now"));
oy += celly;
// Now do names.
i = 0;
@ -240,7 +242,8 @@ void VoipStatistics::updateDisplay()
rsPeers->getOnlineList(idList);
time_t minTS = time(NULL);
time_t now = time(NULL);
time_t minTS = now;
time_t maxTS = 0;
double maxRTT = 0;
@ -254,6 +257,15 @@ void VoipStatistics::updateDisplay()
for(rit = results.begin(); rit != results.end(); rit++)
{
/* only want maxRTT to include plotted bit */
double dt = now - rit->mTS;
if (dt < MAX_DISPLAY_PERIOD)
{
if (maxRTT < rit->mRTT)
{
maxRTT = rit->mRTT;
}
}
if (minTS > rit->mTS)
{
minTS = rit->mTS;
@ -262,10 +274,6 @@ void VoipStatistics::updateDisplay()
{
maxTS = rit->mTS;
}
if (maxRTT < rit->mRTT)
{
maxRTT = rit->mRTT;
}
}
info[*it] = results;