Closed svenstaro closed 4 years ago
Some measurements with this code:
from time import sleep
from fritzconnection.lib.fritzstatus import FritzStatus
fc = FritzStatus()
while True:
print(fc.str_transmission_rate)
sleep(5)
Test downloading at 500 Mbit/s
Before:
('1.0 MB', '65.6 MB')
('679.4 KB', '32.4 MB')
('332.8 KB', '4.9 MB')
('22.5 KB', '34.5 KB')
('5.2 KB', '154.3 KB')
('11.0 KB', '399.9 KB')
('338.6 KB', '75.5 KB')
('133.0 KB', '1.2 MB')
('1.0 MB', '61.7 MB')
('553.0 KB', '-769531142.0 bytes')
('1.1 MB', '58.4 MB')
('1.1 MB', '63.4 MB')
('1.0 MB', '62.8 MB')
('474.6 KB', '31.1 MB')
('805.7 KB', '58.0 MB')
('1.0 MB', '66.4 MB')
('586.4 KB', '63.8 MB')
('1.1 MB', '30.4 MB')
('790.3 KB', '64.3 MB')
('782.4 KB', '60.1 MB')
('1.1 MB', '70.5 MB')
('532.3 KB', '32.8 MB')
('1.0 MB', '69.3 MB')
('804.1 KB', '-753839585.0 bytes')
('386.0 KB', '62.0 MB')
('885.7 KB', '32.7 MB')
('301.7 KB', '14.2 MB')
('559.1 KB', '6.0 MB')
('248.2 KB', '35.2 KB')
After:
('282.9 KB', '56.9 KB')
('12.9 KB', '104.4 KB')
('954.0 KB', '54.6 MB')
('851.8 KB', '39.1 MB')
('225.8 KB', '34.3 KB')
('13.2 KB', '7.5 KB')
('7.5 KB', '67.4 KB')
('9.7 KB', '390.9 KB')
('352.3 KB', '34.1 KB')
('117.2 KB', '198.9 KB')
('737.6 KB', '43.7 MB')
('969.1 KB', '54.8 MB')
('1002.1 KB', '54.3 MB')
('976.1 KB', '52.0 MB')
('1002.5 KB', '55.2 MB')
('799.8 KB', '55.2 MB')
('728.8 KB', '53.8 MB')
('744.7 KB', '51.7 MB')
('1.0 MB', '56.8 MB')
('1013.1 KB', '59.1 MB')
('815.2 KB', '54.3 MB')
('646.8 KB', '53.1 MB')
('1009.4 KB', '59.1 MB')
('1.0 MB', '57.2 MB')
('750.0 KB', '58.3 MB')
('680.7 KB', '54.6 MB')
('707.8 KB', '56.2 MB')
('742.1 KB', '55.8 MB')
Thank you for this! I was really wanting to see data usage but the value going negative really messed that up 😅
@kbr any chance you can merge this and cut a release? It would help my graphs tremendously.
Hopefully in July I may have some time to work on the next release.
The problem with the previous methods for getting the total byte counts is that it would overflow too often. Overflowing is a lot less likely with 64bit integers. Also, this changes the transmission rate calculation or rather it removes it and uses the values provided by the fritzbox directly.
I tested this in my own network and it seems to work just fine.
This should also fix #20.