ec2_cost, rcs_cost: calculate cost from the start of the

instance, rather than the uptime
This commit is contained in:
Dustin Kirkland 2010-05-21 09:30:48 -05:00
commit 05a3ff5f50
3 changed files with 7 additions and 6 deletions

5
debian/changelog vendored
View file

@ -1,11 +1,16 @@
byobu (2.76) unreleased; urgency=low
[ Dustin Kirkland ]
* usr/bin/byobu-select-session: default to -UDR, the "author's favorite"
according to the screen(1) manpage; slightly more secure as it logs out
other sessions; special handling is needed if the user wants to share
sessions, LP: #578373; also, droping the -x should fix some resize
problems, LP: #553085
[ Jon Bernard ]
* ec2_cost, rcs_cost: calculate cost from the start of the
instance, rather than the uptime
-- Dustin Kirkland <kirkland@ubuntu.com> Sat, 15 May 2010 16:52:04 -0400
byobu (2.75-0ubuntu1) maverick; urgency=low

View file

@ -71,9 +71,7 @@ rx_gb=`echo "$ifconfig_out" | grep "RX bytes:" | sed "s/^.*RX bytes://" | awk '{
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
# BUG: This will only calculate uptime since boot!
# Some additional input will be required to account for reboots!!!
hours=`awk '{printf "%f", 1 + $1 / 60 / 60 }' /proc/uptime | sed 's/\..*$//' `
hours=$(((`date +%s` - `stat --printf %Z /etc/crontab`) / 60 / 60))
uptime_cost=`echo "$hours" | awk "{printf \"%f\", "$RATE" * $hours}"`
total_cost=`echo "$network_cost" "$uptime_cost" | awk '{printf "%.2f", $1 + $2}'`

View file

@ -74,9 +74,7 @@ rx_gb=`echo "$ifconfig_out" | grep "RX bytes:" | sed "s/^.*RX bytes://" | awk '{
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
# BUG: This will only calculate uptime since boot!
# Some additional input will be required to account for reboots!!!
hours=`awk '{printf "%f", 1 + $1 / 60 / 60 }' /proc/uptime | sed 's/\..*$//' `
hours=$(((`date +%s` - `stat --printf %Z /etc/crontab`) / 60 / 60))
uptime_cost=`echo "$hours" | awk "{printf \"%f\", "$MEMORY_RATE" * $hours}"`
total_cost=`echo "$network_cost" "$uptime_cost" | awk '{printf "%.2f", $1 + $2}'`