On 2/7/03 12:13 AM, arturo at ethicist.net typeth: > Here's what you need to do. Put the following into a file named cpu.sh: > > #! /bin/sh > i=0 > j=0 > while [ $i -lt 100 ] > do > i=`expr $i + 1` > echo $i > done | > while read k ; do j=$j$k; done; > > After putting the above in cpu.sh do a > chmod 777 cpu.sh > then do > time ./cpu.sh > > You'll see some statistics like so: > > % time ./cpu.sh > 0.150u 1.100s 0:01.47 85.0% 0+0k 0+0io 0pf+0w > > The first # is user cpu seconds consumed (0.150u) then > the second # is system cpu seconds consumed (1.100s) then > the third number is elapsed time (0:01.47) in minutes:seconds > the fourth number is percentage of total available CPU time consumed > (85%) > > Alternatively you can use the other "time" command and get somewhat > simplified output: > > /usr/bin/time ./cpu.sh > 1.31 real 0.21 user 1.04 sys > > > If you would (or need :-) the test to take longer just modify the > > while [ $i -lt 100 ] > > to something like > > while [ $i -lt 1000 ] > > At 1000 I get on my 450MHz Cube > /usr/bin/time ./cpu.sh > 13.80 real 2.18 user 10.20 sys > > Thirteen seconds to count to 1000 :-) Here's what I get on my dual 800 (using 100 as written above): [Cube:~] laurie% time ./cpu.sh 0.120u 0.940s 0:00.88 120.4% 0+0k 0+0io 0pf+0w [Cube:~] laurie% /usr/bin/time ./cpu.sh 0.88 real 0.14 user 0.85 sys