* bin/network: read bytes sent/received straight from /proc; more

efficient


Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
This commit is contained in:
Dustin Kirkland 2009-06-21 12:44:57 -05:00
commit a100720b1d
2 changed files with 5 additions and 4 deletions

View file

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

4
debian/changelog vendored
View file

@ -31,11 +31,13 @@ byobu (2.13) unreleased; urgency=low
panel
* bin/ec2_cost, bin/ip_address, bin/network: get default interface from
/proc/net/route, much more efficient
* bin/network: read bytes sent/received straight from /proc; more
efficient
[ Ciemon Dunville ]
* byobu.1: reflect the keybinding toggle change to Ctrl-a-!
-- Dustin Kirkland <kirkland@ubuntu.com> Sun, 21 Jun 2009 12:31:52 -0500
-- Dustin Kirkland <kirkland@ubuntu.com> Sun, 21 Jun 2009 12:44:19 -0500
byobu (2.12-0ubuntu1) karmic; urgency=low