Skip to content

Commit

Permalink
Merge pull request #48 from m-lab/sandbox-roberto-server-side-upload-…
Browse files Browse the repository at this point in the history
…measurements

Show server-side measurements during the upload phase.
  • Loading branch information
robertodauria authored Jun 29, 2021
2 parents 51b05c4 + d8e2ba5 commit 9f2be52
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/measure/measure.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,23 @@ angular.module('Measure.Measure', ['ngRoute'])
})
},
uploadMeasurement: function(data) {
if (data.Source === 'client') {
if (data.Source === 'server') {
$scope.$apply(function () {
$scope.currentSpeed = data.Data.MeanClientMbps.toFixed(2) + ' Mb/s';
// bytes * 1/microseconds * bits/byte
$scope.currentSpeed = (data.Data.TCPInfo.BytesReceived /
data.Data.TCPInfo.ElapsedTime * 8).toFixed(2) + ' Mb/s';
});
}
if (data.Source === 'client') {
gaugeProgress = (data.Data.ElapsedTime > TIME_EXPECTED) ? 1.0 :
data.Data.ElapsedTime / (TIME_EXPECTED * 2) + 0.5;
ProgressGauge.progress(gaugeProgress, false);
}
},
uploadComplete: function (data) {
$scope.measurementResult.c2sRate =
data.LastClientMeasurement.MeanClientMbps.toFixed(2) + ' Mb/s';
console.log(data);
(data.LastServerMeasurement.TCPInfo.BytesReceived /
data.LastServerMeasurement.TCPInfo.ElapsedTime * 8).toFixed(2) + ' Mb/s';
},
},
).then(() => {
Expand Down

0 comments on commit 9f2be52

Please sign in to comment.