From 68f8443ca3704271cb848d1d48f4f58f2e50aab6 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Fri, 19 Jun 2009 00:24:38 -0500 Subject: [PATCH] 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 --- bin/network | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/network b/bin/network index 7016d559..28ad8f95 100755 --- a/bin/network +++ b/bin/network @@ -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 }'`