mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 14:24:39 -07:00
ec2_cost, rcs_cost: calculate cost from the start of the
instance, rather than the uptime
This commit is contained in:
commit
05a3ff5f50
3 changed files with 7 additions and 6 deletions
5
debian/changelog
vendored
5
debian/changelog
vendored
|
@ -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
|
||||
|
|
|
@ -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}'`
|
||||
|
||||
|
|
|
@ -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}'`
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue