revert part of the network performance improvements

still need to figure out the most efficient way to parse
/proc/net/dev

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
This commit is contained in:
Dustin Kirkland 2009-06-19 00:24:38 -05:00
commit 68f8443ca3

View file

@ -32,6 +32,7 @@ if [ "$1" = "--detail" ]; then
fi
t2=`date +%s`
ifconfig=`ifconfig "$interface" | grep "RX bytes:"`
for i in up down; do
cache="/var/run/screen/S-$USER/$PKG.network_$i"
t1=`stat -c %Y "$cache"` 2>/dev/null || t1=0
@ -42,10 +43,10 @@ for i in up down; do
x1=`cat "$cache"` 2>/dev/null || tx1=0
if [ "$i" = "up" ]; then
symbol="^"
x2=`grep "$interface:" /proc/net/dev | awk '{print $10}'`
x2=`echo "$ifconfig" | sed "s/^.*TX bytes://" | awk '{print $1}'`
else
symbol="v"
x2=`grep "$interface:" /proc/net/dev | awk '{print $2}'`
x2=`echo "$ifconfig" | sed "s/^.*RX bytes://" | awk '{print $1}'`
fi
echo "$x2" > "$cache"
rate=`echo "$t1" "$t2" "$x1" "$x2" | awk '{printf "%.0f", ($4 - $3) / ($2 - $1) / 1024 }'`