Skip to content

Commit

Permalink
ignore known virtual devices (br, tun)
Browse files Browse the repository at this point in the history
  • Loading branch information
biji committed Mar 26, 2017
1 parent 9cb2f08 commit fa7d724
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,15 @@ function parseStat() {
let fields = line.split(/\W+/);
if (fields.length<=2) break;

if (fields[0] != "lo" && !isNaN(parseInt(fields[1]))) {
count = count + parseInt(fields[1]) + parseInt(fields[9]);
countUp = countUp + parseInt(fields[9]);
if (fields[0] != "lo" &&
!fields[0].match(/^virbr[0-9]+/) &&
!fields[0].match(/^br[0-9]+/) &&
!fields[0].match(/^vnet[0-9]+/) &&
!fields[0].match(/^tun[0-9]+/) &&
!fields[0].match(/^tap[0-9]+/) &&
!isNaN(parseInt(fields[1]))) {
count = count + parseInt(fields[1]) + parseInt(fields[9]);
countUp = countUp + parseInt(fields[9]);
}
}
fstream.close(null);
Expand Down

0 comments on commit fa7d724

Please sign in to comment.