mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 06:23:19 -07:00
* bin/network: read bytes sent/received straight from /proc; more
efficient Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
This commit is contained in:
parent
1bd2255ced
commit
a100720b1d
2 changed files with 5 additions and 4 deletions
|
@ -32,7 +32,6 @@ if [ "$1" = "--detail" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
t2=`date +%s`
|
t2=`date +%s`
|
||||||
ifconfig=`ifconfig "$interface" | grep "RX bytes:"`
|
|
||||||
for i in up down; do
|
for i in up down; do
|
||||||
cache="/var/run/screen/S-$USER/$PKG.network_$i"
|
cache="/var/run/screen/S-$USER/$PKG.network_$i"
|
||||||
t1=`stat -c %Y "$cache"` 2>/dev/null || t1=0
|
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
|
x1=`cat "$cache"` 2>/dev/null || tx1=0
|
||||||
if [ "$i" = "up" ]; then
|
if [ "$i" = "up" ]; then
|
||||||
symbol="^"
|
symbol="^"
|
||||||
x2=`echo "$ifconfig" | sed "s/^.*TX bytes://" | awk '{print $1}'`
|
x2=`grep -m1 "$interface:" /proc/net/dev | sed "s/^.*://" | awk '{print $9}'`
|
||||||
else
|
else
|
||||||
symbol="v"
|
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
|
fi
|
||||||
echo "$x2" > "$cache"
|
echo "$x2" > "$cache"
|
||||||
rate=`echo "$t1" "$t2" "$x1" "$x2" | awk '{printf "%.0f", ($4 - $3) / ($2 - $1) / 1024 }'`
|
rate=`echo "$t1" "$t2" "$x1" "$x2" | awk '{printf "%.0f", ($4 - $3) / ($2 - $1) / 1024 }'`
|
||||||
|
|
4
debian/changelog
vendored
4
debian/changelog
vendored
|
@ -31,11 +31,13 @@ byobu (2.13) unreleased; urgency=low
|
||||||
panel
|
panel
|
||||||
* bin/ec2_cost, bin/ip_address, bin/network: get default interface from
|
* bin/ec2_cost, bin/ip_address, bin/network: get default interface from
|
||||||
/proc/net/route, much more efficient
|
/proc/net/route, much more efficient
|
||||||
|
* bin/network: read bytes sent/received straight from /proc; more
|
||||||
|
efficient
|
||||||
|
|
||||||
[ Ciemon Dunville ]
|
[ Ciemon Dunville ]
|
||||||
* byobu.1: reflect the keybinding toggle change to Ctrl-a-!
|
* 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
|
byobu (2.12-0ubuntu1) karmic; urgency=low
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue