#! /bin/sh
# PCP QA Test No. 206
# interpolate mode and archives with gaps and mark records
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc.  All Rights Reserved.
#

seq=`basename $0`
echo "QA output created by $seq"

# get standard filters
. ./common.product
. ./common.filter
. ./common.check

trap "rm -f $tmp.*; exit" 0 1 2 3 15

host=`hostname`
date=`pmdumplog -l src/gap | grep commencing | 
	sed -e 's/  commencing //' -e 's/\.[0-9]*//'`
offset=`_arch_start src/gap 0.5`

_filter_val()
{
    sed \
	-e "s/$host[\.a-zA-Z0-9\-]*/HOST/g" \
	-e "s/$date/DATE/g" \
	-e "s/start:.*/start:     START_TIME/g" \
	-e "s/end:.*/end:       END_TIME/g" \
	-e "s/^[0-2][0-9]:[0-5][0-9]:[0-5][0-9]\.[0-9][0-9][0-9][ ][ ]*[0-9][0-9\.]*/TIME VALUE/" \
	-e "s/^[0-2][0-9]:[0-5][0-9]:[0-5][0-9]\.[0-9][0-9][0-9]/TIME/" \
	-e "s/VALUE[ 	]*$/VALUE/"
}

# real QA test starts here
rm -f $tmp.out
touch $tmp.out

for metric in \
    hinv.ncpu \
    pmcd.pdu_in.total pmcd.pdu_in.fetch \
    pmcd.numagents \
    sample.bin
do
    echo >> $tmp.out
    echo "pmval args: -U -r" >>$tmp.out
    pmval -r -U src/gap $metric >>$tmp.out 2>$tmp.err
    cat $tmp.err >>$tmp.out
    echo >>$tmp.out
    echo "pmval args: -a -r" >>$tmp.out
    pmval -s 10 -O $offset -r -t2 -a src/gap $metric >>$tmp.out 2>$tmp.err
    cat $tmp.err >>$tmp.out
    echo >>$tmp.out
    echo "pmval args: -a" >>$tmp.out
    pmval -s 10 -O $offset -t2 -a src/gap $metric >>$tmp.out 2>$tmp.err
    cat $tmp.err >>$tmp.out
done

cat $tmp.out | _filter_val
