* bin/ec2-cost: performance improvement, cache ifconfig output

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
This commit is contained in:
Dustin Kirkland 2009-06-08 11:45:10 -05:00
commit 0129e90655
2 changed files with 6 additions and 3 deletions

View file

@ -52,9 +52,11 @@ TX_RATE="0.17"
# Auto detect network interface
IF=`/sbin/route -n | grep "0\.0\.0\.0" | tail -n1 | awk '{print $8}'`
ifconfig_out=`/sbin/ifconfig "$IF"`
# Calculate bandwidth cost
tx_gb=`/sbin/ifconfig "$IF" | grep "TX bytes:" | sed "s/^.*TX bytes://" | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }'`
rx_gb=`/sbin/ifconfig "$IF" | grep "RX bytes:" | sed "s/^.*RX bytes://" | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }'`
tx_gb=`echo "$ifconfig_out" | grep "TX bytes:" | sed "s/^.*TX bytes://" | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }'`
rx_gb=`echo "$ifconfig_out" | grep "RX bytes:" | sed "s/^.*RX bytes://" | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }'`
network_cost=`echo "$tx_gb" "$TX_RATE" "$rx_gb" "$RX_RATE" | awk '{printf "%f %f", $1*$2, $3*$4}' | awk '{printf "%f", $1 + $2}'`
# Calculate uptime cost

3
debian/changelog vendored
View file

@ -7,8 +7,9 @@ byobu (2.9) unreleased; urgency=low
* bin/cpu-count: performance improvement, use getconf
* bin/cpu-freq: performance improvement, simplify pipes
* bin/disk-*: use the POSIX output format
* bin/ec2-cost: performance improvement, cache ifconfig output
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 08 Jun 2009 11:40:33 -0500
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 08 Jun 2009 11:44:07 -0500
byobu (2.8-0ubuntu1) karmic; urgency=low