Fixed throughput calculation.

Added local download and upload images.
This commit is contained in:
Ziver Koc 2014-08-05 17:45:25 +02:00
parent 1c35a97240
commit d9052dfff3
47 changed files with 106 additions and 8 deletions

View file

@ -129,10 +129,10 @@ public class UeControlExecutor implements Runnable, UeBehaviour.DataHandledListe
}
protected boolean setRealDataUsage(){
boolean ret = false;
//long currentRxBytes = TrafficStats.getUidRxBytes(MainActivity.getUID());
//long currentTxBytes = TrafficStats.getUidTxBytes(MainActivity.getUID());
long currentRxBytes = TrafficStats.getTotalRxBytes();
long currentTxBytes = TrafficStats.getTotalTxBytes();
long currentRxBytes = TrafficStats.getUidRxBytes(MainActivity.getUID());
long currentTxBytes = TrafficStats.getUidTxBytes(MainActivity.getUID());
//long currentRxBytes = TrafficStats.getTotalRxBytes();
//long currentTxBytes = TrafficStats.getTotalTxBytes();
if (currentRxBytes != TrafficStats.UNSUPPORTED && currentTxBytes != TrafficStats.UNSUPPORTED
&& previousRxBytes != TrafficStats.UNSUPPORTED && previousTxBytes != TrafficStats.UNSUPPORTED){

View file

@ -17,7 +17,7 @@ public class ThroughputCalculator {
long currentTimeStamp = System.nanoTime();
data_amount += bytes;
if(currentTimeStamp - (NANOSEC_PER_SECOND/UPDATES_PER_SEC) > previousTimeStamp) {
throughput = data_amount / ((currentTimeStamp - previousTimeStamp) / (NANOSEC_PER_SECOND/UPDATES_PER_SEC));
throughput = data_amount / ((currentTimeStamp - previousTimeStamp) / NANOSEC_PER_SECOND);
previousTimeStamp = currentTimeStamp;
data_amount = 0;
updated = true;