* Re: [Powertop] [PATCH] devices: Fix processing /proc/net/dev file
@ 2012-10-15 16:22 Chris Ferron
0 siblings, 0 replies; 5+ messages in thread
From: Chris Ferron @ 2012-10-15 16:22 UTC (permalink / raw)
To: powertop
[-- Attachment #1: Type: text/plain, Size: 1218 bytes --]
On 10/15/2012 07:33 AM, Namhyung Kim wrote:
> 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(a)gmail.com>
> ---
> src/devices/network.cpp | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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;
>
> }
Your patch has been merged
Thank You
-C
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Powertop] [PATCH] devices: Fix processing /proc/net/dev file
@ 2012-10-15 14:59 Sergey Senozhatsky
0 siblings, 0 replies; 5+ messages in thread
From: Sergey Senozhatsky @ 2012-10-15 14:59 UTC (permalink / raw)
To: powertop
[-- Attachment #1: Type: text/plain, Size: 550 bytes --]
On (10/15/12 23:56), Namhyung Kim wrote:
> 2012-10-15 (월), 07:47 -0700, Sergey Senozhatsky:
> > On (10/15/12 23:33), Namhyung Kim wrote:
> > > @@ -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;
> > >
> > > }
> > > --
> >
> > or `i++' after `if (i == 1 || i == 10)'.
>
> But if we moved `i++', it should be `if (i == 1 || i == 9)'.
>
yeah, right :)
-ss
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Powertop] [PATCH] devices: Fix processing /proc/net/dev file
@ 2012-10-15 14:56 Namhyung Kim
0 siblings, 0 replies; 5+ messages in thread
From: Namhyung Kim @ 2012-10-15 14:56 UTC (permalink / raw)
To: powertop
[-- Attachment #1: Type: text/plain, Size: 471 bytes --]
2012-10-15 (월), 07:47 -0700, Sergey Senozhatsky:
> On (10/15/12 23:33), Namhyung Kim wrote:
> > @@ -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;
> >
> > }
> > --
>
> or `i++' after `if (i == 1 || i == 10)'.
But if we moved `i++', it should be `if (i == 1 || i == 9)'.
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Powertop] [PATCH] devices: Fix processing /proc/net/dev file
@ 2012-10-15 14:47 Sergey Senozhatsky
0 siblings, 0 replies; 5+ messages in thread
From: Sergey Senozhatsky @ 2012-10-15 14:47 UTC (permalink / raw)
To: powertop
[-- Attachment #1: Type: text/plain, Size: 1268 bytes --]
On (10/15/12 23:33), Namhyung Kim wrote:
> 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(a)gmail.com>
> ---
> src/devices/network.cpp | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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;
>
> }
> --
or `i++' after `if (i == 1 || i == 10)'.
the patch looks good to me, nice catch.
-ss
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Powertop] [PATCH] devices: Fix processing /proc/net/dev file
@ 2012-10-15 14:33 Namhyung Kim
0 siblings, 0 replies; 5+ messages in thread
From: Namhyung Kim @ 2012-10-15 14:33 UTC (permalink / raw)
To: powertop
[-- Attachment #1: Type: text/plain, Size: 1080 bytes --]
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(a)gmail.com>
---
src/devices/network.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
}
--
1.7.9.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-10-15 16:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-15 16:22 [Powertop] [PATCH] devices: Fix processing /proc/net/dev file Chris Ferron
-- strict thread matches above, loose matches on Subject: below --
2012-10-15 14:59 Sergey Senozhatsky
2012-10-15 14:56 Namhyung Kim
2012-10-15 14:47 Sergey Senozhatsky
2012-10-15 14:33 Namhyung Kim
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.