I've been doing some developement (really just compilation) on my iPod and I
wanted to know how it was doing, loadwise, just by a glance at the screen.
It didn't have xload or tload or anything like that so I wrote this script:
#! /bin/sh
sleeptime=5
ratio=20
ratio100=$((100/ratio))
ratioone=$((ratio-1))
while : ; do
load100=`uptime | cut -f 4 -d :`
load100=`echo ${load100%,} | tr -d . | sed 's/^0*//'`
xes=$(( ( load100 - ( load100 / 100 ) * 100 ) / ratio100 ))
(
for digit in `seq 1 ${load100%??}` ; do
yes x | head -$ratioone ; echo '|'
done
yes x | head -$xes
) | tr -d '\n'; echo
sleep $sleeptime
done
Doesn't automatically scale as tload does, but it works. And the chart is
sideways compared to tload. I probably don't need all those spaces inside
$(( )). The bit with two declarations of $load100 is to strip off the
leading space, and it's slightly faster this way. Maybe I'll modify it to
do some fancy arithmetic to avoid the division in the while loop.
-- -eben QebWenE01R@vTerYizUonI.nOetP royalty.mine.nu:81 A. A Top Poster \ http://www.fscked.co.uk/ B. Who's there? \ writing/ A. Knock-knock -- from bobward@xxx.com \ top-posting-cuss.html ----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:16:01 EDT