mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 14:24:39 -07:00
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 <kirkland@canonical.com>
This commit is contained in:
parent
7190ce6ca4
commit
68f8443ca3
1 changed files with 3 additions and 2 deletions
|
@ -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 }'`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue