Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement RPM methodology (draft-02) #562

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Works with mobile versions too.
* Telemetry (optional)
* Results sharing (optional)
* Multiple Points of Test (optional)
* Responsiveness Under Working Conditions (optional)

![Screenshot](https://speedtest.fdossena.com/mpot_v6.gif)

Expand Down
9 changes: 9 additions & 0 deletions doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ __Features:__
* Telemetry (optional)
* Results sharing (optional)
* Multiple Points of Test (optional)
* Responsiveness Under Working Conditions

__Browser support:__
The test supports any browser that supports XHR Level 2 and Web Workers. JavaScript must be enabled.
Expand Down Expand Up @@ -627,6 +628,14 @@ Jitter is the variance in ping times.

See the code for more implementation details.

#### Responsiveness tests

The Responsiveness tests follows [this draft](https://datatracker.ietf.org/doc/draft-ietf-ippm-responsiveness/). The goal is to measure ping on loaded connections. You can do in both way upload and download.

This test also measures the bandwidth.

See the code for more implementation details.

### `backend` files
#### `garbage.php`
Uses OpenSSL to generate a stream of incompressible garbage data for the download test.
Expand Down
62 changes: 62 additions & 0 deletions docker/standalone.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ function updateUI(forced){
drawMeter(I("ulMeter"),mbpsToAmount(Number(uiData.ulStatus*(status==3?oscillate():1))),meterBk,ulColor,Number(uiData.ulProgress),progColor);
I("pingText").textContent=format(uiData.pingStatus);
I("jitText").textContent=format(uiData.jitterStatus);
I("rpmUlText").textContent=(status==4&&uiData.rpmUlStatus==0)?"...":uiData.rpmUlStatus;
I("rpmUlRatioText").textContent=(status==4&&uiData.rpmUlStatus==0)?"...":uiData.rpmUlRatioStatus;
I("rpmDlText").textContent=(status==5&&uiData.rpmDlStatus==0)?"...":uiData.rpmDlStatus;
I("rpmDlRatioText").textContent=(status==5&&uiData.rpmDlStatus==0)?"...":uiData.rpmDlRatioStatus;
}
function oscillate(){
return 1+0.02*Math.sin(Date.now()/100);
Expand All @@ -129,6 +133,10 @@ function initUI(){
I("pingText").textContent="";
I("jitText").textContent="";
I("ip").textContent="";
I("rpmUlText").textContent="";
I("rpmUlRatioText").textContent="";
I("rpmDlText").textContent="";
I("rpmDlRatioText").textContent="";
}
</script>
<style type="text/css">
Expand Down Expand Up @@ -217,6 +225,9 @@ function initUI(){
div.meterText:empty:before{
content:"0.00";
}
div.rpmText:empty:before {
content: "0";
}
div.testArea div.unit{
position:absolute;
bottom:2em; left:0;
Expand All @@ -226,6 +237,27 @@ function initUI(){
div.testArea2 div.unit{
display:inline-block;
}
div.respTitle {
font-size: 1.5em;
}
div.respArea {
margin-top: 1em;
display: flex;
justify-content: center;
align-items: center;
}
div.respWay {
font-size: 1.2em;
}
div.respResultArea {
margin: 4em;
margin-top: 1em;
margin-bottom: 2em;
}
div.respResult {
width: 100%;
display: block ruby;
}
div.testArea canvas{
position:absolute;
top:0; left:0; width:100%; height:100%;
Expand Down Expand Up @@ -310,6 +342,33 @@ function initUI(){
<div class="unit">Mbps</div>
</div>
</div>
<div id="respTest">
<div class="respTitle">Responsiveness Under Working Conditions</div>
<div class="respArea">
<div class="respResultArea">
<div class="testName">Download</div>
<div class="respResult">
<div id="rpmDlText"></div>
<div>RPM</div>
</div>
<div class="respResult">
<div> Factor of latency increase :</div>
<div id="rpmDlRatioText">-</div>
</div>
</div>
<div class="respResultArea">
<div class="testName">Upload</div>
<div class="respResult">
<div id="rpmUlText"></div>
<div>RPM</div>
</div>
<div class="respResult">
<div> Factor of latency increase :</div>
<div id="rpmUlRatioText">-</div>
</div>
</div>
</div>
</div>
<div id="ipArea">
<span id="ip"></span>
</div>
Expand All @@ -320,6 +379,9 @@ function initUI(){
<img src="" id="resultsImg" />
</div>
</div>
<div style="margin-bottom: 2em">
The RPM is the number of Round-trip time (RTT) Per Minute. This metric describes the latency under working conditions. <a href="https://datatracker.ietf.org/doc/draft-ietf-ippm-responsiveness/">Click here to know more about it.</a>
</div>
<a href="https://github.com/librespeed/speedtest">Source code</a>
</div>
<div id="privacyPolicy" style="display:none">
Expand Down
7 changes: 4 additions & 3 deletions speedtest.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
At the end of the test, it will move to state 4
- 4: test finished. You can run it again by calling start() if you want.
*/

const FINISHED_STATE = 6, // finished
ABORT_STATE = 7; // abort
function Speedtest() {
this._serverList = []; //when using multiple points of test, this is a list of test points
this._selectedServer = null; //when using multiple points of test, this is the selected server
Expand Down Expand Up @@ -329,11 +330,11 @@ Speedtest.prototype = {
} catch (e) {
console.error("Speedtest onupdate event threw exception: " + e);
}
if (data.testState >= 4) {
if (data.testState >= FINISHED_STATE) {
clearInterval(this.updater);
this._state = 4;
try {
if (this.onend) this.onend(data.testState == 5);
if (this.onend) this.onend(data.testState == ABORT_STATE);
} catch (e) {
console.error("Speedtest onend event threw exception: " + e);
}
Expand Down
Loading