#!/bin/sh
#
# @(#)nhfsrun.sh 1.3 89/07/07 Copyright (c) 1989, Legato Systems, Inc.
#
# See DISCLAIMER file for restrictions
#

#
# Usage: nhfsrun [suffix]
#
# Run nhfsstone with a range of different loads and put
# results in a file called run.<suffix>
#

if [ $# -gt 1 ]; then
    echo "usage: $0 [suffix]"
    exit 1
fi

#
# Output file
#
if [ $# -eq 1 ]; then
    OUTFILE=run.$1
else
    OUTFILE=run.out
fi

#
# Starting load
#
START=10

#
# Ending load
#
END=80

#
# Load increment
#
INCR=10

#
# Catch SIGUSR1 and ignore it.
# SIGUSR1 is used by nhfsstone to synchronize child processes.
#
nothing() { echo -n ""; }
trap nothing USR1

rm -f $OUTFILE

LOAD=$START
while [ $LOAD -le $END ]; do
    echo nhfsstone -l $LOAD
    nhfsstone -l $LOAD >> $OUTFILE
    tail -n 1 $OUTFILE
    LOAD=`expr $LOAD + $INCR`
done