mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 14:24:39 -07:00
* bin/network: pull network bytes directly from /proc/net/dev, performance
improvement Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
This commit is contained in:
parent
448f953cd3
commit
0bdee971dc
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=`/sbin/ifconfig "$interface" | grep "RX bytes" | sed "s/.*:\(.*\) (.*:\(.*\) (.*/\1\n\2/"`
|
|
||||||
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
|
||||||
|
@ -42,11 +41,11 @@ for i in up down; do
|
||||||
else
|
else
|
||||||
x1=`cat "$cache"` 2>/dev/null || tx1=0
|
x1=`cat "$cache"` 2>/dev/null || tx1=0
|
||||||
if [ "$i" = "up" ]; then
|
if [ "$i" = "up" ]; then
|
||||||
x2=`echo "$ifconfig" | tail -n1`
|
|
||||||
symbol="^"
|
symbol="^"
|
||||||
|
x2=`grep "$interface:" /proc/net/dev | awk '{print $10}'`
|
||||||
else
|
else
|
||||||
x2=`echo "$ifconfig" | head -n1`
|
|
||||||
symbol="v"
|
symbol="v"
|
||||||
|
x2=`grep "$interface:" /proc/net/dev | awk '{print $2}'`
|
||||||
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
|
@ -34,8 +34,10 @@ byobu (2.12) unreleased; urgency=low
|
||||||
improvement
|
improvement
|
||||||
* bin/load_average: drop "cat", and just use awk, performance
|
* bin/load_average: drop "cat", and just use awk, performance
|
||||||
improvement
|
improvement
|
||||||
|
* bin/network: pull network bytes directly from /proc/net/dev, performance
|
||||||
|
improvement
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Tue, 16 Jun 2009 20:46:37 -0500
|
-- Dustin Kirkland <kirkland@ubuntu.com> Tue, 16 Jun 2009 20:47:32 -0500
|
||||||
|
|
||||||
byobu (2.11-0ubuntu1) karmic; urgency=low
|
byobu (2.11-0ubuntu1) karmic; urgency=low
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue