From: "Alfie Costa" To: mulinux@sunsite.auc.dk Date: Wed, 23 Feb 2000 01:37:29 -0500 Subject: [mu TECH] benchmarking a shell script Lines: 51 --Message-Boundary-23374 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body On 18 Feb 00, at 9:15, Alfie Costa wrote: > Novice benchmarking question: is there a timer command in mu that shows > how long something takes? If there is not, then the attached script works... Usage: timeit command [various arguments...] Outputs whatever command does, and the number in seconds of how long command took to run. --Message-Boundary-23374 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Text from file 'Timeit' #!/bin/ash # Sun Feb 20 07:50 2000 - A. Costa # Time how long a command takes in seconds. #Syntax opt=$1 case Z$opt in Z-d) set -x;shift;; # debug mode... Z-h|Z) echo "Usage : timeit [-h] command [args...]" ; exit ;; *) esac # get start time. # NOTE: `cat /proc/uptime` outputs two numbers like "123.45 125.67", # so the sed stuff gets rid of all but the "123" begintime=`cat /proc/uptime | sed 's/\..*$//'` "$@" endtime=`cat /proc/uptime | sed 's/\..*$//'` expr $endtime - $begintime --Message-Boundary-23374 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.auc.dk For additional commands, e-mail: mulinux-help@sunsite.auc.dk --Message-Boundary-23374--