ndt-project / ndt

Network Diagnostic Tool
Other
178 stars 45 forks source link

make the speedometer max value configurable #186

Open aaronmbr opened 9 years ago

aaronmbr commented 9 years ago

Right now, the maximum value of the speedometer in the HTML5-frontend is 100Mbps. It'd be good if that was made easily configurable.

bchase78 commented 9 years ago

Your widget is already displayed before and during testing. When you initialize the gauge then you must choose the scale. This means that you have to know how fast the connection is going to be before testing has even started.
In my project, my work around was to first show the gauges after testing. Using the following code, I dynamically changed the bit rate display units based on test results:

var s = ['kB/s', 'MB/s', 'GB/s', 'TB/s', 'PB/s', 'EB/s']; var e = Math.floor(Math.log(speedinKB) / Math.log(1000)); var value = (speedinKB / Math.pow(1000, e)).toFixed(2);

s[e] is the target unit (kb/s , mb/s, ...)

A compromise would be to show the gauge in 1000's instead of 100's. That way you could draw the scale to start with, and then just change the unit.

check out https://github.com/bchase78/wsndt/blob/master/js/ndt_client.js#L226 to see how i did it.

aaronmbr commented 9 years ago

It all depends on what the gauge is supposed to "mean". e.g. if I have a 10G host, and you're getting 50M because that's the limits of your bandwidth, should the gauges be showing the 10G limit of the server, the 50M limit of the client or just what the client happens to be getting? My preference would be to let administrators define what the server can do, or what they expect clients can do. A "gauge set to 1000 and set the units appropriately" might not be an unreasonable default though.

bchase78 commented 9 years ago

I have submitted a patch for this behavior. You can try it out at: http://ndt.fh-luebeck.de

aaronmbr commented 9 years ago

I merged the patch, though not via the pull request (due to some changes upstream). Thanks!