bertrandmartel / speed-test-lib

:cloud: JSpeedTest : speed test client library for Java/Android
MIT License
381 stars 119 forks source link

SpeedTestReport : getTransferRateBit() #19

Closed NickGuaGua closed 7 years ago

NickGuaGua commented 7 years ago

public void onDownloadProgress(float percent, SpeedTestReport report) { report.getTransferRateBit() } The result will be cumulatively. I think the calculation seems to be wrong, and here is my calculation :

            float getTemporaryPacketSize = report.getTemporaryPacketSize();
            float intervalDLSize = getTemporaryPacketSize-tempSize;
            tempSize = getTemporaryPacketSize;

            if(tempDLTime ==0)
                tempDLTime = report.getStartTime();

            long getReportTime = report.getReportTime();
            long intervalDLTime = getReportTime-tempDLTime ;
            tempDLTime = getReportTime;

            float mKBps = (intervalDLSize/intervalDLTime)*1000/8/1000 ;
bertrandmartel commented 7 years ago

The result will be cumulatively

Yes, it will give you the speed test rate on the whole period (cumulating all the speed rate obtained from the chunks uploaded/downloaded during that time)