#!/bin/sh
############################################################################
#   Copyright 2007,2008 Impinj, Inc.
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.
#
############################################################################

rm -f *.tmp

if [ $# -ne 1 ]
then
    echo "Usage: $0 READER"
    exit
fi

READER="$1"

echo "===================================================="
echo "== Run dx201 with valgrind."
echo "== This verifies no memory leak."
echo "== Please inspect the output."
echo "== The line that says 'malloc/free: in use at exit:'"
echo "== should say ' 0 bytes in 0 blocks.'"
echo "===================================================="
valgrind ./dx201 -vv $READER > /dev/null
echo ""
echo ""
echo ""



echo "===================================================="
echo "== Run dx201 for CPU/Mem characterization"
echo "== Series 1of2 -- no XML encoding."
echo "== There will be three runs."
echo "== Sum the user CPU time and the number of tags."
echo "== Divide the CPU time by the number of tags."
echo "== That is the CPU utlization per tag report."
echo "===================================================="
echo "== Series 1of2 -- Run 1of3"
time ./dx201 -qq0 $READER 
echo "== Series 1of2 -- Run 2of3"
time ./dx201 -qq0 $READER 
echo "== Series 1of2 -- Run 3of3"
time ./dx201 -qq0 $READER 
echo ""
echo ""
echo ""



echo "===================================================="
echo "== Run dx201 for CPU/Mem characterization"
echo "== Series 2of2 -- with XML encoding."
echo "== There will be three runs."
echo "== Sum the user CPU time and the number of tags."
echo "== Divide the CPU time by the number of tags."
echo "== That is the CPU utlization per tag report."
echo "===================================================="
echo "== Series 1of2 -- Run 1of3"
time ./dx201 -qqvv0 $READER 
echo "== Series 1of2 -- Run 2of3"
time ./dx201 -qqvv0 $READER 
echo "== Series 1of2 -- Run 3of3"
time ./dx201 -qqvv0 $READER 
echo ""
echo ""
echo ""



echo "===================================================="
echo "== Done with dx201 test series"
echo "===================================================="
