Skip to content

Commit

Permalink
feat(network): use bps instead of kbps
Browse files Browse the repository at this point in the history
  • Loading branch information
huangyoukun committed Jun 26, 2018
1 parent 89841bc commit 93124a3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bin/tsw/util/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ this.getNetInfo = function() {
incr[type].transmit.bytes = sum[type].transmit.bytes - cache.total[type].transmit.bytes;
incr[type].transmit.packets = sum[type].transmit.packets - cache.total[type].transmit.packets;

curr[type].receive.bytes = Math.floor(incr[type].receive.bytes * 8 / cost * 1000 / 1024); // Kbps
curr[type].receive.packets = Math.floor(incr[type].receive.packets * 1000 / cost);
curr[type].transmit.bytes = Math.floor(incr[type].transmit.bytes * 8 / cost * 1000 / 1024); // Kbps
curr[type].transmit.packets = Math.floor(incr[type].transmit.packets * 1000 / cost);
curr[type].receive.bytes = Math.floor(incr[type].receive.bytes * 8 / (cost / 1000)); // bps
curr[type].receive.packets = Math.floor(incr[type].receive.packets / (cost / 1000));
curr[type].transmit.bytes = Math.floor(incr[type].transmit.bytes * 8 / (cost / 1000)); // bps
curr[type].transmit.packets = Math.floor(incr[type].transmit.packets / (cost / 1000));
});

cache.curr = curr;
Expand Down

0 comments on commit 93124a3

Please sign in to comment.