Permalink
Browse files

Merge latency-plots and www-maintenance patches

Verified that everything works well by using the web interface
both in english and italian.
  • Loading branch information...
2 parents 80cd101 + adb09a0 commit 0a523988fbe9d6b5df9e4125bf47f5e0c91fae56 @bassosimone bassosimone committed Feb 12, 2012
@@ -34,6 +34,8 @@ <h4 class="i18n i18n_bittorrent_title">Your recent bittorrent results</h4>
</div>
<div id="chartdiv1"></div>
+ <div id="chartdiv2"></div>
+
<div id="results">
<!-- nothing -->
</div>
View
@@ -457,7 +457,7 @@ a#x_link_to_status {
color: #3da64e;
font-size: normal;
}
-#chartdiv1 {
+#chartdiv1, #chartdiv2 {
margin-bottom: 20px;
height: 400px;
width: 100%;
@@ -100,21 +100,25 @@ var bittorrent = (function() {
var ipCounterN = 0;
var downloadData = [];
var uploadData = [];
+ var connectData = [];
var downloadLabels = [];
var uploadLabels = [];
+ var connectLabels = [];
for (i = 0; i < data.length; i++) {
var result = data[i];
var address = result["real_address"];
var timestamp = result["timestamp"];
var download = result["download_speed"];
var upload = result["upload_speed"];
+ var connect = result["connect_time"];
// Update IP counter
if (ipCounter[address] == undefined) { // XXX
ipCounter[address] = ipCounterN;
downloadData[ipCounterN] = [];
uploadData[ipCounterN] = [];
+ connectData[ipCounterN] = [];
downloadLabels[ipCounterN] = {
label: "DOWN " + address,
markerOptions: {
@@ -129,20 +133,35 @@ var bittorrent = (function() {
},
neighborThreshold: -1
};
+ connectLabels[ipCounterN] = {
+ label: "Connect time " + address,
+ markerOptions: {
+ style: 'circle'
+ },
+ neighborThreshold: -1
+ };
ipCounterN++;
}
- // Timestamp to millisecond
+ // Convert to millisecond
timestamp *= 1000;
+ connect *= 1000;
// XXX must convert to Number or it does not plot
counter = ipCounter[address];
download = Number(utils.toMbitsPerSecondNumber(download));
upload = Number(utils.toMbitsPerSecondNumber(upload));
downloadData[counter].push([timestamp, download]);
uploadData[counter].push([timestamp, upload]);
+ connectData[counter].push([timestamp, connect]);
}
+ /*
+ * TODO For correctness, refactor the code below such that,
+ * if (very unlikely) we have connect_time data but not goodput
+ * data, we are still able to plot connect_time data.
+ */
+
mydata = downloadData.concat(uploadData);
if (!mydata.length) {
return;
@@ -200,6 +219,43 @@ var bittorrent = (function() {
plot.replot();
+ mydata = connectData;
+ if (!mydata.length) {
+ return;
+ }
+
+ var plot2 = jQuery.jqplot("chartdiv2", mydata, {
+ title: {
+ text: i18n.get("Your bittorrent connect time"),
+ fontSize: "16pt"
+ },
+ axes: {
+ xaxis: xaxis,
+ yaxis: {
+ label: "ms",
+ min: 0
+ }
+ },
+ legend: {
+ show: true,
+ location: "e"
+ },
+ cursor: {
+ showVerticalLine: false,
+ showHorizontalLine: true,
+ showCursorLegend: false,
+ showTooltip: false,
+ tooltipLocation: 'sw',
+ zoom: true
+ },
+ highlighter: {
+ show: false
+ },
+ series: connectLabels
+ });
+
+ plot2.replot();
+
// some additional CSS-magic
jQuery('.jqplot-table-legend').css('top', '200');
};
View
@@ -100,23 +100,33 @@ var speedtest = (function() {
self.results_formatter_plot = function(data, since, unit, until) {
var ipCounter = {};
var ipCounterN = 0;
+
var downloadData = [];
var uploadData = [];
+ var latencyData = [];
+ var connectData = [];
+
var downloadLabels = [];
var uploadLabels = [];
+ var latencyLabels = [];
+ var connectLabels = [];
for (i = 0; i < data.length; i++) {
var result = data[i];
var address = result["real_address"];
var timestamp = result["timestamp"];
var download = result["download_speed"];
var upload = result["upload_speed"];
+ var latency = result["latency"];
+ var connect = result["connect_time"];
// Update IP counter
if (ipCounter[address] == undefined) { // XXX
ipCounter[address] = ipCounterN;
downloadData[ipCounterN] = [];
uploadData[ipCounterN] = [];
+ latencyData[ipCounterN] = [];
+ connectData[ipCounterN] = [];
downloadLabels[ipCounterN] = {
label: "DOWN " + address,
markerOptions: {
@@ -131,20 +141,44 @@ var speedtest = (function() {
},
neighborThreshold: -1
};
+ latencyLabels[ipCounterN] = {
+ label: "Latency " + address,
+ markerOptions: {
+ style: 'square'
+ },
+ neighborThreshold: -1
+ };
+ connectLabels[ipCounterN] = {
+ label: "Connect time " + address,
+ markerOptions: {
+ style: 'circle'
+ },
+ neighborThreshold: -1
+ };
ipCounterN++;
}
- // Timestamp to millisecond
+ // Convert to millisecond
timestamp *= 1000;
+ latency *= 1000;
+ connect *= 1000;
// XXX must convert to Number or it does not plot
counter = ipCounter[address];
download = Number(utils.toMbitsPerSecondNumber(download));
upload = Number(utils.toMbitsPerSecondNumber(upload));
downloadData[counter].push([timestamp, download]);
uploadData[counter].push([timestamp, upload]);
+ latencyData[counter].push([timestamp, latency]);
+ connectData[counter].push([timestamp, connect]);
}
+ /*
+ * TODO For correctness, refactor the code below such that,
+ * if (very unlikely) we have connect_time data but not goodput
+ * data, we are still able to plot connect_time data.
+ */
+
mydata = downloadData.concat(uploadData);
if (!mydata.length) {
return;
@@ -172,7 +206,7 @@ var speedtest = (function() {
var plot = jQuery.jqplot("chartdiv1", mydata, {
title: {
- text: i18n.get("Your download and upload speed"),
+ text: i18n.get("Your speedtest download and upload speed"),
fontSize: "16pt"
},
axes: {
@@ -202,6 +236,43 @@ var speedtest = (function() {
plot.replot();
+ mydata = latencyData.concat(connectData);
+ if (!mydata.length) {
+ return;
+ }
+
+ var plot2 = jQuery.jqplot("chartdiv2", mydata, {
+ title: {
+ text: i18n.get("Your speedtest connect time and latency"),
+ fontSize: "16pt"
+ },
+ axes: {
+ xaxis: xaxis,
+ yaxis: {
+ label: "ms",
+ min: 0
+ }
+ },
+ legend: {
+ show: true,
+ location: "e"
+ },
+ cursor: {
+ showVerticalLine: false,
+ showHorizontalLine: true,
+ showCursorLegend: false,
+ showTooltip: false,
+ tooltipLocation: 'sw',
+ zoom: true
+ },
+ highlighter: {
+ show: false
+ },
+ series: latencyLabels.concat(connectLabels)
+ });
+
+ plot2.replot();
+
// some additional CSS-magic
jQuery('.jqplot-table-legend').css('top', '200');
};
View
@@ -94,13 +94,13 @@ var state = (function() {
// Do we need to show or hide the qtip?
if (data.current == "test") {
jQuery('#testResultsBox').qtip("show");
- jQuery('#testResultsBox h4').text(i18n.get(
- "Current test results"));
+ jQuery('#testResultsBox h4').text(
+ i18n.get("Current test results"));
}
else {
jQuery('#testResultsBox').qtip("hide");
- jQuery('#testResultsBox h4').text(i18n.get(
- "Latest test results"));
+ jQuery('#testResultsBox h4').text(
+ i18n.get("Latest test results"));
}
//
View
@@ -23,7 +23,7 @@
//
// WARNING! Autogenerated file: don't edit
// Use './scripts/make_lang_en.py' instead to regenerate it
-// Created: Mon, 23 Jan 2012 14:37:41 GMT
+// Created: Sun, 12 Feb 2012 20:38:55 GMT
//
var LANG = {
@@ -37,9 +37,13 @@ var LANG = {
'Test running': 'Test running',
+ 'Your bittorrent connect time': 'Your bittorrent connect time',
+
'Your bittorrent download and upload speed': 'Your bittorrent download and upload speed',
- 'Your download and upload speed': 'Your download and upload speed',
+ 'Your speedtest connect time and latency': 'Your speedtest connect time and latency',
+
+ 'Your speedtest download and upload speed': 'Your speedtest download and upload speed',
'disabled': 'disabled',
View
@@ -25,11 +25,6 @@
LANG = {
- /* neubot/www/header.html */
-
- 'i18n_header_subtitle': "L'interfaccia web per controllare Neubot",
- 'i18n_header_title': '<a href="index.html">Interfaccia Web di Neubot</a>',
-
/*
* i18n for javascripts
* Map the string on the left to the string on the right via
@@ -44,7 +39,11 @@ LANG = {
'Disable': "Disattiva",
'Test running': "Test in corso",
- 'Your download and upload speed': "Risultati recenti",
+ 'Your bittorrent connect time': 'Tempo per connettersi del test bittorrent',
+ 'Your bittorrent download and upload speed': 'Velocità di download e upload del test bittorrent',
+
+ 'Your speedtest connect time and latency': 'Tempo per connettersi e latenza del test speedtest',
+ 'Your speedtest download and upload speed': 'Velocità di download e upload del test speedtest',
/*
* i18n for HTML pages
@@ -54,6 +53,9 @@ LANG = {
* the right the corresponding translation.
*/
+ 'i18n_header_subtitle': "L'interfaccia web per controllare Neubot",
+ 'i18n_header_title': '<a href="index.html">Interfaccia Web di Neubot</a>',
+
'i18n_text_direction': "ltr",
'i18n_settings': "Impostazioni",
'i18n_status': "Stato",
@@ -38,6 +38,8 @@ <h4 class="i18n i18n_speedtest_title">Your recent speedtest results</h4>
</div>
<div id="chartdiv1"></div>
+ <div id="chartdiv2"></div>
+
<div id="results">
<!-- nothing -->
</div>

0 comments on commit 0a52398

Please sign in to comment.