Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
M
mp-web
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Maalepaaler
mp-web
Commits
c9d56792
Commit
c9d56792
authored
Aug 07, 2014
by
Olav Kvittem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug for x-axes in plot - now covers time from start of measurement
parent
0b2fbe17
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
+18
-15
yt/jsbandwidth.js
yt/jsbandwidth.js
+18
-15
No files found.
yt/jsbandwidth.js
View file @
c9d56792
...
...
@@ -28,7 +28,7 @@ var sizesk=[28, 252, 2500, 25000];
var
grafno
=
0
;
var
tablewidth
=
0
;
var
upcolor
=
'
#000374
'
;
var
upcolor
=
'
#000374
'
;
// from uninett's palett
var
downcolor
=
'
#00612b
'
;
//var series=[{ 'name':'Download', data:[], type: 'scatter' , color: downcolor },
// { 'name':'Upload', data:[], type: 'scatter' , color: upcolor }];
...
...
@@ -66,7 +66,7 @@ function get_progress(e, pregress) { // to be called onprogress in ajax
pregress
.
mbps
=
mbps
;
}
var
span
=
now
-
pregress
.
start
;
var
span
=
now
-
pregress
.
begin
;
curseries
.
addPoint
([
span
/
1000
,
mbps
]);
pregress
.
nmbps
=
mbps
;
...
...
@@ -80,6 +80,7 @@ function get_progress(e, pregress) { // to be called onprogress in ajax
}
}
return
true
;
}
function
progress_speed
(
pregress
,
speed
){
...
...
@@ -103,11 +104,12 @@ function progress_speed( pregress, speed){
}
function
TestDownload
(
speedclass
)
{
start
=
new
Date
().
getTime
();
now
=
new
Date
().
getTime
();
var
pregress
=
{
dir
:
"
down
"
,
loaded
:
0
,
start
:
start
,
start
:
now
,
begin
:
now
,
mbps
:
0
,
nmbps
:
0
,
n
:
0
,
...
...
@@ -119,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>
'
);
...
...
@@ -156,7 +158,7 @@ function TestDownload(speedclass) {
function
download_success
(
msg
){
binfile
[
speedclass
]
=
msg
;
end
=
new
Date
().
getTime
();
dldiff
=
(
end
-
start
)
/
1000
;
dldiff
=
(
end
-
pregress
.
begin
)
/
1000
;
bytes
=
msg
.
length
;
dlspeed
=
(
bytes
*
8
/
dldiff
)
/
1000
/
1000
;
dlspeed
=
progress_speed
(
pregress
,
dlspeed
);
...
...
@@ -176,13 +178,14 @@ function TestDownload(speedclass) {
}
function
TestUpload
(
speedclass
)
{
start
=
new
Date
().
getTime
();
function
TestUpload
(
speedclass
,
start
)
{
var
now
=
new
Date
().
getTime
();
$
(
"
#ulspeed
"
).
html
(
'
<img src=busy.gif>
'
);
var
pregress
=
{
dir
:
"
up
"
,
loaded
:
0
,
start
:
start
,
start
:
now
,
// start progess period
begin
:
now
,
// begin of test series
mbps
:
0
,
nmbps
:
0
,
series
:[],
...
...
@@ -204,10 +207,10 @@ function TestUpload(speedclass) {
dataType
:
'
text
'
,
async
:
true
,
xhr
:
function
(){
// to get upload progress events
var
xhr
=
$
.
ajaxSettings
.
xhr
()
;
var
xhr
=
$
.
ajaxSettings
.
xhr
()
;
xhr
.
upload
.
onprogress
=
function
(
e
)
{
progress_last
=
get_progress
(
e
,
pregress
);
return
0
;
};
//
xhr.upload.addEventListener('progress', function(e) {progress_last= get_progress(e, pregress); }, false);
return
xhr
;
//
xhr.upload.addEventListener('progress', function(e) {progress_last= get_progress(e, pregress); }, false);
return
xhr
;
},
// this this works for get
// xhrFields: {
...
...
@@ -216,11 +219,11 @@ function TestUpload(speedclass) {
success
:
function
(
msg
)
{
end
=
new
Date
().
getTime
();
uldiff
=
(
end
-
start
)
/
1000
;
// ms to sec
uldiff
=
(
end
-
pregress
.
begin
)
/
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
);
...
...
@@ -230,7 +233,7 @@ function TestUpload(speedclass) {
ulsum
+=
ulspeed
;
uldiffsum
+=
uldiff
;
ulno
++
;
ulavg
=
Math
.
round
(
ulsum
/
ulno
*
10
)
/
10
;
var
speed
=
Math
.
max
(
ulavg
,
dlavg
);
var
speed
=
Math
.
max
(
ulavg
,
dlavg
,
ulspeed
,
dlspeed
);
refv
=
speed
.
toPrecision
(
1
);
// pixsz = $(window).width() / 2 / refv;
if
(
tablewidth
==
0
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment