#! /bin/sh
# Yet another cool script, runs each spec app in either of the 3 predn mode
#I removed the 2> stderr redirect from scripts now, so i can see stuff on screen
#Has reading params from input cmdline & checking for input
#if cond-l

here=`pwd`

if [ $# -ne 1 ]; then
         echo 1>&2 " "
         echo 1>&2 "  Usage: $0 <Prediction Type>"
	 echo 1>&2 "    Prediction Type: [ L (LastValue) or C (ConstHiPwr) or G (MemGPHT) ]"
	 echo 1>&2 "    i.e. $0 G "
         echo 1>&2 " "
         exit 1
fi

if [ $1 == "L" ]; then
    PREDN_TYPE=MemLastValue
    PMC_SAMPLER=/home/canturk/CANO_PHASE_DVFS/CANO_PHASE_DVFS_sampler_MemLastValue
elif [ $1 == "C" ]; then
    PREDN_TYPE=ConstHiPwr
    PMC_SAMPLER=/home/canturk/CANO_PHASE_DVFS/CANO_PHASE_DVFS_sampler_ConstHiPwr
elif [ $1 == "G" ]; then
    PREDN_TYPE=MemGPHT
    PMC_SAMPLER=/home/canturk/CANO_PHASE_DVFS/CANO_PHASE_DVFS_sampler_MemGPHT
else
    echo 1>&2 " "    
    echo 1>&2 "  Invalid Prediction Type: $1 --> SHOULD BE [L or C or G]"    
    echo 1>&2 " "    
    exit 1
fi

echo " "
echo "PREDN TYPE: $PREDN_TYPE"

echo "PWD: $here"
DELTA_INS=100000


cd /home/canturk/benches/myapplu  # <-- change this

BENCH=myapplu  # <-- change this
echo "${BENCH}"
echo "${PMC_SAMPLER} -D ${DELTA_INS} ./applu_base.O3 < applu.in > applu.out" # <-- change this
echo "mv ./PHASE_log   ${here}/${BENCH}_${PREDN_TYPE}.PHASElog"
echo "mv ./PREDN_stats ${here}/${BENCH}_${PREDN_TYPE}.PREDNstats"


