lib/byobu/network, share/man/man1/byobu.1: clean up binary/decimal

multipliers for network transfer vs. memory/disk capacities, in
accordance with industry standards
This commit is contained in:
Dustin Kirkland 2010-08-23 23:46:34 -04:00
commit e5fe4abe37
3 changed files with 21 additions and 8 deletions

4
debian/changelog vendored
View file

@ -1,6 +1,8 @@
byobu (3.3) unreleased; urgency=low
* UNRELEASED
* lib/byobu/network, share/man/man1/byobu.1: clean up binary/decimal
multipliers for network transfer vs. memory/disk capacities, in
accordance with industry standards
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 23 Aug 2010 17:52:26 -0400

View file

@ -37,7 +37,6 @@ t2=`date +%s`
for i in up down; do
cache="$DIR/$PKG.network_$i"
t1=`stat -c %Y "$cache"` 2>/dev/null || t1=0
unit="kB/s"
if [ $t2 -le $t1 ]; then
rate=0
else
@ -53,15 +52,23 @@ for i in up down; do
rate=`echo "$t1" "$t2" "$x1" "$x2" | awk '{printf "%.0f", ($4 - $3) / ($2 - $1) / 1024 }'`
if [ "$rate" -lt 0 ]; then
rate=0
elif [ "$rate" -gt 1024 ]; then
rate=`echo "$rate" | awk '{printf "%.1f", $1/1024}'`
unit="MB/s"
fi
# Some users want to see bps rather than B/s
# 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=`echo "$unit" | sed "s:B/s:bps:"`
unit="kbps"
if [ "$rate" -gt 1000 ]; then
rate=`echo "$rate" | awk '{printf "%.1f", $1/1000}'`
unit="Mbps"
fi
;;
*)
unit="kB/s"
if [ "$rate" -gt 1024 ]; then
rate=`echo "$rate" | awk '{printf "%.1f", $1/1000}'`
unit="MB/s"
fi
;;
esac
fi

View file

@ -95,7 +95,11 @@ For example:
$ BYOBU_WINDOWS=ssh_sessions byobu
.SH UNITS OF MEASURE
byobu uses binary for measurements rather than decimal for KB, MB, and GB. This means multiples of 1024 rather than multiples of 1000, in accordance with JEDEC Standard 100B.01.
byobu uses binary for capacity measurements of KB, MB, GB, and TB. This means multiples of 1024 rather than multiples of 1000, in accordance with JEDEC Standard 100B.01 for disk and memory capacity measurements. See:
* http://en.wikipedia.org/wiki/JEDEC_memory_standards
byobu uses decimal for measurements of network data transfer, meaning multiple of 1000, rather than 1024. See:
* http://en.wikipedia.org/wiki/Data_rate_units
.SH KEYBINDINGS