blob: 7cab58addbf4dd738f3b91ed462ff758615baf47 (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
#!/bin/awk -f
BEGIN {
while ("for f in /sys/class/net/[ew]*; do paste $f/statistics/[rt]x_bytes; done" | getline) {
d+=$1; u+=$2; }
getline < "/tmp/test"; od=$1; ou=$2; ot=$3;
getline < "/proc/uptime"; t=$1;
print d,u,t > "/tmp/test";
t=t-ot; if (!t) t=1;
printf "%.1f/%.1f MB/s\n", ((d-od)/1000000)/t, ((u-ou)/1000000)/t;
}
|