Commit e4f8270e authored by Olav Kvittem's avatar Olav Kvittem

bug x-values now from start of each transfer

parent b44d692a
......@@ -2,19 +2,19 @@
<head>
<?php include 'head-bs.html'?>
<style type="text/css" title="currentStyle">
@import "/js/jquery-ui-1.10.3/themes/base/jquery-ui.css";
@import "js/jquery-ui-1.10.3/themes/base/jquery-ui.css";
</style>
<script type="text/javascript" src="/js/jquery-ui-1.10.3/ui/jquery-ui.js"></script>
<link href="/js/select2/select2.css" rel="stylesheet"/>
<script type="text/javascript" src="/js/select2/select2.js"></script>
<script type="text/javascript" src="/js/mp-select.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.10.3/ui/jquery-ui.js"></script>
<link href="js/select2/select2.css" rel="stylesheet"/>
<script type="text/javascript" src="js/select2/select2.js"></script>
<script type="text/javascript" src="js/mp-select.js"></script>
</head>
<body>
<?php include 'body-bs.html'?>
<script>
$("#title-bs").html('<a href="https://www.uninett.no/malepale-detaljer">Mleple</a>'); // title
$('#top-menu-bs').load("/top-menu-bs.html");
$('#top-menu-bs').load("top-menu-bs.html");
$('#body-bs').load("mp-web-bs.html"); // main body content
</script>
......
......@@ -5,7 +5,7 @@ var opera=navigator.userAgent.match(/^Opera/) != null;
var firefox=navigator.userAgent.match(/Firefox/) != null;
var min_test_length= 0.5; // minimum testing period seconds
var min_progress_interval = 10; // min interval to be used for estimates
var min_progress_interval = 20; // min interval to be used for estimates
var test_period=10000; // interrup test after ms
......@@ -66,6 +66,7 @@ function get_progress(e, pregress) { // to be called onprogress in ajax
pregress.mbps=mbps;
}
if ( ! pregress.begin ) pregress.begin=pregress.start;
var span=now-pregress.begin;
curseries.addPoint([span/1000, mbps]);
......@@ -80,7 +81,7 @@ function get_progress(e, pregress) { // to be called onprogress in ajax
}
}
return true;
// return true;
}
function progress_speed( pregress, speed){
......@@ -104,12 +105,11 @@ function progress_speed( pregress, speed){
}
function TestDownload(speedclass) {
now = new Date().getTime();
start = new Date().getTime();
var pregress={
dir: "down",
loaded: 0,
start: now,
begin: now,
start: start,
mbps: 0,
nmbps: 0,
n: 0,
......@@ -121,7 +121,7 @@ function TestDownload(speedclass) {
if ( speedclass == 0 ){ // make new series
seriesno++;
curseries=chart.addSeries( { 'name':'Download ' + seriesno, data:[], type: 'scatter' , color: downcolor });
}
}
pregress.total=sizesk[speedclass]*1000;
$("#dlspeed").html('<img src=busy.gif>');
......@@ -158,7 +158,7 @@ function TestDownload(speedclass) {
function download_success(msg){
binfile[speedclass] = msg;
end = new Date().getTime();
dldiff = (end - pregress.begin) / 1000;
dldiff = (end - start) / 1000;
bytes = msg.length;
dlspeed = (bytes * 8 / dldiff) / 1000/ 1000;
dlspeed = progress_speed( pregress, dlspeed );
......@@ -178,14 +178,13 @@ function TestDownload(speedclass) {
}
function TestUpload(speedclass, start) {
var now = new Date().getTime();
function TestUpload(speedclass) {
start = new Date().getTime();
$("#ulspeed").html('<img src=busy.gif>');
var pregress={
dir: "up",
loaded: 0,
start: now, // start progess period
begin: now, // begin of test series
start: start,
mbps: 0,
nmbps: 0,
series:[],
......@@ -219,11 +218,11 @@ function TestUpload(speedclass, start) {
success: function(msg) {
end = new Date().getTime();
uldiff = ( end - pregress.begin ) / 1000; // ms to sec
uldiff = ( end - start ) / 1000; // ms to sec
if ( uldiff < min_test_length && (speedclass+1) < (binfile.length)){
console.log( 'class ' + speedclass + ' up time ' + uldiff);
TestUpload(speedclass+1);
} else {
console.log( 'class ' + speedclass + ' up time ' + uldiff);
bytes = binfile[speedclass].length;
ulspeed = (bytes * 8 / uldiff) / 1000 / 1000;
ulspeed=progress_speed( pregress, ulspeed );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment