#!/bin/bash
if [ $# -lt 3 ];then
echo "Usage: $0 <exe> <input file> <capacity range> <k range>"
echo "Example: <$0> ./lruk sorted7_11 '10G,50G,160G' '1,2,3,4'"
echo "Example: <$0> ./lru sorted7_11 '10G,50G,160'"
echo "Example: <$0> ./mk sorted7_11 '10G,50G,160G' '1,2,3,4' '8,10,12'"
exit 1
fi
params=()
c=0
for i in "$@";do
params[$c]=$i
c=`expr $c + 1`
done
level=$#
resultParams=()
e=$1
inforDir=(${1 })
fInforDir=${inforDir[1]}_experiment_result
if [ ! -d "$fInforDir" ];then
mkdir $fInforDir
fi
function contain_params(){
#n=`expr $1 + 1`
if [ $1 -lt $level ];then
p=${params[$1]}
ps=(${p//,/ })
for k in ${ps[@]};do
resultParams[`expr $1 - 1`]=$k
contain_params `expr $1 + 1`
done
else
information=${inforDir[2]}
for ii in "${resultParams[@]:1}";do
information=${information}_${ii}
done
echo -n "${params[0]} ${resultParams[@]}," >> $fInforDir/result.txt
${params[0]} ${resultParams[@]} >> $fInforDir/${information}_infor.txt
echo -n `grep "^RATIO" $fInforDir/${information}_infor.txt | cut -d'=' -f2` >> $fInforDir/result.txt
grep "BYTE_RATIO" $fInforDir/${information}_infor.txt | cut -d'=' -f2 >> $fInforDir/result.txt
fi
}
contain_params 1