From 9c8145a3ed5414050539eb84b7c4b86645117d14 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Wed, 15 Sep 2010 13:24:34 -0600 Subject: [PATCH] that minimum hours is 1, not 0; LP: #639855 * usr/lib/byobu/network: use bps rather than B/s by default for network traffic, LP: #578377 --- debian/changelog | 4 +++- usr/lib/byobu/network | 29 +++++++++++++++++++---------- usr/share/man/man1/byobu.1 | 2 +- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1c2347ce..26e4dafa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,7 +7,9 @@ byobu (3.5) unreleased; urgency=low * usr/lib/byobu/rcs_cost, usr/lib/byobu/ec2_cost: testing crontab creation time is not accurate, seems this happens at image creation rather than instance instantiation; use /etc/hostname instead; ensure - that minimum hours is 1, not 0 + that minimum hours is 1, not 0; LP: #639855 + * usr/lib/byobu/network: use bps rather than B/s by default for network + traffic, LP: #578377 -- Dustin Kirkland Wed, 01 Sep 2010 13:11:34 -0600 diff --git a/usr/lib/byobu/network b/usr/lib/byobu/network index d97fb94a..0e09d96e 100755 --- a/usr/lib/byobu/network +++ b/usr/lib/byobu/network @@ -53,21 +53,30 @@ for i in up down; do if [ "$rate" -lt 0 ]; then rate=0 fi - # Why 1000 and not 1024? http://en.wikipedia.org/wiki/Data_rate_units case "$NETWORK_UNITS" in - bits) - rate=`echo "$rate" | awk '{printf "%.0f", $1*8}'` - unit="kbps" - if [ "$rate" -gt 1000 ]; then - rate=`echo "$rate" | awk '{printf "%.1f", $1/1000}'` - unit="Mbps" + bytes) + if [ "$rate" -gt 1048576 ]; then + rate=`echo "$rate" | awk '{printf "%.1f", $1/1048576}'` + unit="GB/s" + elif [ "$rate" -gt 1024 ]; then + rate=`echo "$rate" | awk '{printf "%.1f", $1/1024}'` + unit="MB/s" + else + unit="kB/s" fi ;; *) - unit="kB/s" - if [ "$rate" -gt 1024 ]; then + # Default to bps + rate=`echo "$rate" | awk '{printf "%.0f", $1*8}'` + # Why 1000 and not 1024? http://en.wikipedia.org/wiki/Data_rate_units + if [ "$rate" -gt 1000000 ]; then + rate=`echo "$rate" | awk '{printf "%.1f", $1/1000000}'` + unit="Gbps" + elif [ "$rate" -gt 1000 ]; then rate=`echo "$rate" | awk '{printf "%.1f", $1/1000}'` - unit="MB/s" + unit="Mbps" + else + unit="kbps" fi ;; esac diff --git a/usr/share/man/man1/byobu.1 b/usr/share/man/man1/byobu.1 index 51f9068a..b55a0049 100644 --- a/usr/share/man/man1/byobu.1 +++ b/usr/share/man/man1/byobu.1 @@ -56,7 +56,7 @@ byobu \- wrapper script for seeding a user's byobu configuration and launching s \fBmenu\fP \- a simple indicator directing new users to use the F9 keybinding to access the byobu menu -\fBnetwork\fP \- instantaneous upload/download bandwidth in kB/s over the last 3 seconds; displayed in the lower bar toward the right in white text on a purple background with a leading '^' sign indicating 'up' and 'v' sign indicating 'down'; override the default interface by specifying an alternate interface with MONITORED_NETWORK=eth1, and override the default units (kB/s) with NETWORK_UNITS=bits in \fI$HOME/.byobu/statusrc\fP +\fBnetwork\fP \- instantaneous upload/download bandwidth in [GMk]bps over the last 3 seconds; displayed in the lower bar toward the right in white text on a purple background with a leading '^' sign indicating 'up' and 'v' sign indicating 'down'; override the default interface by specifying an alternate interface with MONITORED_NETWORK=eth1, and override the default units (bits) with NETWORK_UNITS=bytes in \fI$HOME/.byobu/statusrc\fP \fBprocesses\fP \- total number of processes running on the system; displayed in the lower bar in white text on a dark yellow background with a trailing '&' indicating 'background processes'