Suppose I have a machine with a network card (Ethernet or otherwise),
and I wanted to know the utilization percentage of the card. That is,

bytes transferred in/out in 1 second
Utilization = ----------------------------------------------------------
maximum possible bytes that can be transferred in 1
second

How do I

1) Programatically find out what the card's maximum transfer rate is?

2) Programatically find out how many bytes have been transferred in
the last second?

My operation system is Linux.

Thank you.

Rigoberto