W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2011

[whatwg] XHR Level 2: Accurate Speed Measurement

From: Karl Dubost <karld@opera.com>
Date: Wed, 23 Nov 2011 21:06:09 -0500
Message-ID: <4105CF36-C5DE-408F-B708-FA3F9621C80F@opera.com>

Le 23 nov. 2011 ? 10:14, Rodger Combs a ?crit :
> XHR currently provides no reliable method of determining the actual upload or download speed of a transfer. 


There's a lot of issues to be able to do something like this.

1. "reliable". The network is not reliable is the first issue. 
   All data you would get would be an estimate.
2. The network speed is usually not linear.

# XHR.timeRemaining = estimated time left in ms

Let's assume, we got the right content-length header.
The time remaining is a function of the download pattern which has already happened. An Integral to recalculate. Maybe a linear approximation is enough, not sure.

# XHR.completionTime = a Date object representing the estimated completion time

date.now() + XHR.timeRemaining is not ok?


# XHR.transferRate = upload/download speed, measured in Kbps, as an integer.

So you are saying the current transferRate or the integral of the past transferRate from the beginning?


-- 
Karl Dubost - http://dev.opera.com/
Developer Relations & Tools, Opera Software
Received on Wednesday, 23 November 2011 18:06:09 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:09 UTC