2014-04-07 10:48:33

by Ken O'Brien

[permalink] [raw]
Subject: proc net statistics

Hi,

I was under the impression that statistics reported
in /proc/{$pid}/net/dev were specific to that process, but the values
appear to be globals, i.e., identical for all processes.

Is this a bug?

Regards,

Ken


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part

2014-04-07 17:06:33

by Cong Wang

[permalink] [raw]
Subject: Re: proc net statistics

On Mon, Apr 7, 2014 at 3:39 AM, Ken O'Brien <[email protected]> wrote:
> Hi,
>
> I was under the impression that statistics reported
> in /proc/{$pid}/net/dev were specific to that process, but the values
> appear to be globals, i.e., identical for all processes.
>
> Is this a bug?

That is per network-namespace statistics, so it is
not a bug.

2014-04-07 17:19:52

by Cong Wang

[permalink] [raw]
Subject: Re: proc net statistics

On Mon, Apr 7, 2014 at 10:10 AM, Ken O'Brien <[email protected]> wrote:
>
> Ok, so then, is there a way to read per process network statistics in the proc filesystem?
>

AFAIK, we only have per-socket and per-netdev statistics, there is no
per-process one, you probably want to try cgroup, or put these processes
into a namespace.

2014-04-07 17:26:13

by Daniel Borkmann

[permalink] [raw]
Subject: Re: proc net statistics

On 04/07/2014 07:19 PM, Cong Wang wrote:
> On Mon, Apr 7, 2014 at 10:10 AM, Ken O'Brien <[email protected]> wrote:
>>
>> Ok, so then, is there a way to read per process network statistics in the proc filesystem?
>
> AFAIK, we only have per-socket and per-netdev statistics, there is no
> per-process one, you probably want to try cgroup, or put these processes
> into a namespace.

You can do that with cgroups, e.g. xt_cgroup. Samsung/Tizen OS seems to make
use of this ...

https://git.kernel.org/cgit/linux/kernel/git/davem/net.git/commit/?id=a00e76349f3564bb8129fc0510dfd93248c3084d