librespeed / speedtest-cli

Command line client for LibreSpeed
GNU Lesser General Public License v3.0
483 stars 59 forks source link

at high speeds the downlink speed end up negative #43

Open kabbech opened 2 years ago

kabbech commented 2 years ago

when starting the download the speed rises up to 1,8 gbps then suddenly it drops down to -500mbps which will be the registered speed, at lower speeds it doesn't happen, I have another use case where the speed is below 1gbps then I don't see the issue

braamb commented 2 years ago

Getting negative download results on a Raspberry Pi for the armv7 binary when the duration is set to 40 seconds:

$ ./librespeed-cli --version
librespeed-cli v1.0.9 (built on 2021-05-08T02:42:16Z)
https://github.com/librespeed/speedtest-cli
Licensed under GNU Lesser General Public License v3.0
LibreSpeed  Copyright (C) 2016-2020 Federico Dossena
librespeed-cli  Copyright (C) 2020 Maddie Zhan
librespeed.org  Copyright (C)

Here is the command used and output:

$ ./librespeed-cli --duration 40 --local-json ./servers.json
Using local JSON server list: ./servers.json
Selecting the fastest server based on ping
Selected server: a [192.168.88.8]
You're testing from: 192.168.1.21 - private IPv4 access
Ping: 2 ms  Jitter: 0 ms
Download rate:  -164.82 Mbps
Upload rate:    279.96 Mbps

The Raspberry Pi is on gigabit Ethernet running Raspbian lite:

$ uname -a
Linux raspberry 5.4.51-v7l+ #1333 SMP Mon Aug 10 16:51:40 BST 2020 armv7l GNU/Linux
$ cat /etc/debian_version
10.4
Taurolyon commented 2 years ago

Strangely enough, I think this could be related to 32-bit integers. I'm not much of a programmer, but I'm taking electrical engineering in college, and I happened to stumble across this video. The presenter explains how when a popular video exceeded over 2-billion views on YouTube it suddenly went negative. This has to do with the overflow bit that allows a binary integer to be positive or negative.

For example, a 3-bit integer can be 0111 (equal to a decimal 7), but a 1111, would be equal to a decimal -7 because of the leading bit.