usr/lib/byobu/disk_io: fix scaling, LP: #787773

This commit is contained in:
Dustin Kirkland 2011-05-24 22:24:48 -05:00
commit 18d24bbb76
2 changed files with 8 additions and 3 deletions

1
debian/changelog vendored
View file

@ -2,6 +2,7 @@ byobu (4.3) unreleased; urgency=low
* usr/lib/byobu/uptime: fix string bug in uptime introduced by smoser's * usr/lib/byobu/uptime: fix string bug in uptime introduced by smoser's
changes changes
* usr/lib/byobu/disk_io: fix scaling, LP: #787773
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 23 May 2011 19:21:36 -0500 -- Dustin Kirkland <kirkland@ubuntu.com> Mon, 23 May 2011 19:21:36 -0500

View file

@ -73,15 +73,19 @@ for i in "read" "write"; do
x2="$a7" x2="$a7"
fi fi
echo "$x2" > "$cache" echo "$x2" > "$cache"
rate=$((($x2-$x1) / ($t2 - $t1) * 512 / 1024)) rate=$((($x2 - $x1) / ($t2 - $t1) * 512 / 1024))
if [ "$rate" -lt 0 ]; then if [ "$rate" -lt 0 ]; then
rate=0 rate=0
elif [ "$rate" -gt 1048576 ]; then elif [ "$rate" -gt 1048576 ]; then
fpdiv "$rate" 1048576 1
unit="GB/s" unit="GB/s"
fpdiv "$rate" 1048576 0
rate=${_RET}
elif [ "$rate" -gt 1024 ]; then elif [ "$rate" -gt 1024 ]; then
fpdiv "$rate" 1024 1
unit="MB/s" unit="MB/s"
fpdiv "$rate" 1024 0
rate=${_RET}
else
unit="kB/s"
fi fi
fi fi
[ "$rate" != "0" ] || continue [ "$rate" != "0" ] || continue