diff options
author | Namhyung Kim <namhyung@gmail.com> | 2012-10-15 23:33:36 +0900 |
---|---|---|
committer | Chris E Ferron <chris.e.ferron@linux.intel.com> | 2012-10-15 09:12:53 -0700 |
commit | d4f477d9f7415f0f68356368e62b6449273a5298 (patch) | |
tree | 56f20e60a4ea6a5d2fbc6c48c929209a9542c478 | |
parent | a5e4a312d86ebb51b7b26942b0a9632b72620d23 (diff) |
devices: Fix processing /proc/net/dev file
The do_proc_net_dev() reads the /proc/net/dev file and counts tx/rx
packets for each interface. However index for rx packet (1) is not
match to the file:
$ cat /proc/net/dev
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13) (14) (15) (16)
Change the index to 2 to match to the number of receive packets.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
-rw-r--r-- | src/devices/network.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/devices/network.cpp b/src/devices/network.cpp index b8a5c9c..3b67610 100644 --- a/src/devices/network.cpp +++ b/src/devices/network.cpp @@ -114,7 +114,7 @@ static void do_proc_net_dev(void) c2 = c; val = strtoull(c, &c, 10); i++; - if (i == 1 || i == 10) + if (i == 2 || i == 10) pkt += val; } |