[mu TECH] benchmarking a shell script

From: Alfie Costa (agcosta@gis.net)
Date: Wed Feb 23 2000 - 07:37:29 CET

On 18 Feb 00, at 9:15, Alfie Costa <mulinux@sunsite.auc.dk> 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.

# Sun Feb 20 07:50 2000 - A. Costa
# Time how long a command takes in seconds.


case Z$opt in
Z-d) set -x;shift;; # debug mode...
Z-h|Z) echo "Usage : timeit [-h] command [args...]" ; exit ;;

# 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

To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.auc.dk
For additional commands, e-mail: mulinux-help@sunsite.auc.dk

This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:13 CET