diff --git a/bin/network b/bin/network index acfc3611..7016d559 100755 --- a/bin/network +++ b/bin/network @@ -32,7 +32,6 @@ if [ "$1" = "--detail" ]; then fi t2=`date +%s` -ifconfig=`/sbin/ifconfig "$interface" | grep "RX bytes" | sed "s/.*:\(.*\) (.*:\(.*\) (.*/\1\n\2/"` 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,11 +41,11 @@ for i in up down; do else x1=`cat "$cache"` 2>/dev/null || tx1=0 if [ "$i" = "up" ]; then - x2=`echo "$ifconfig" | tail -n1` symbol="^" + x2=`grep "$interface:" /proc/net/dev | awk '{print $10}'` else - x2=`echo "$ifconfig" | head -n1` symbol="v" + x2=`grep "$interface:" /proc/net/dev | awk '{print $2}'` fi echo "$x2" > "$cache" rate=`echo "$t1" "$t2" "$x1" "$x2" | awk '{printf "%.0f", ($4 - $3) / ($2 - $1) / 1024 }'` diff --git a/debian/changelog b/debian/changelog index 577beb30..a596061d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -34,8 +34,10 @@ byobu (2.12) unreleased; urgency=low improvement * bin/load_average: drop "cat", and just use awk, performance improvement + * bin/network: pull network bytes directly from /proc/net/dev, performance + improvement - -- Dustin Kirkland Tue, 16 Jun 2009 20:46:37 -0500 + -- Dustin Kirkland Tue, 16 Jun 2009 20:47:32 -0500 byobu (2.11-0ubuntu1) karmic; urgency=low