refine the traffic stat

This commit is contained in:
Max Lv
2015-11-18 14:53:56 +08:00
parent e667a77b71
commit 07b9cfa7f1
2 changed files with 7 additions and 3 deletions
@@ -20,8 +20,8 @@ object TrafficMonitor {
var rxTotal: Long = 0
def getTraffic(): Traffic = {
new Traffic(TrafficStats.getUidTxBytes(uid),
TrafficStats.getUidRxBytes(uid), System.currentTimeMillis())
new Traffic(TrafficStats.getTotalTxBytes - TrafficStats.getUidTxBytes(uid),
TrafficStats.getTotalRxBytes - TrafficStats.getUidRxBytes(uid), System.currentTimeMillis())
}
def formatTraffic(n: Long): String = {