On 3/8/06, Joel VanderWerf <vjoel / path.berkeley.edu> wrote:
> Joe Van Dyk wrote:
> ...
> >   - gets the utilization percentage of a NIC on the machine
> ...
>
> I've been wondering how to do that, either on 2.4 or 2.6. What are you
> using?

I don't have the code in front of me, but there's a file in /proc
(maybe /proc/net?) that details the TX and RX information for each NIC
(in packets or bytes transferred).  Keep track of the total amount of
stuff transferred over time, divide by the capacity of the NIC over
that time period (I think I cheat and assume gigabit NICs, since
that's all we have here), and there you are.

It turns out that it's pretty hard to get the utilization much above
10%.  But I'm not sure of the best way of generating a ton of useless
network traffic.

Joe