mirror of https://gitlab.com/QEF/q-e.git
62 lines
2.1 KiB
Bash
Executable File
62 lines
2.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# check directories given as arguments, current directory if none
|
|
if test $# = 0 ; then args="." ; else args="$@"; fi
|
|
|
|
for dir in $args
|
|
do
|
|
# check working directory
|
|
if test -d "$dir"
|
|
then
|
|
EXAMPLEDIR=`cd $dir; pwd`
|
|
else
|
|
echo error: directory $dir not found
|
|
exit -1
|
|
fi
|
|
echo checking directory $EXAMPLEDIR...
|
|
|
|
REFERENCEDIR=$EXAMPLEDIR/reference
|
|
RESULTSDIR=$EXAMPLEDIR/results
|
|
|
|
# look for output files in reference
|
|
if test ! -d $REFERENCEDIR
|
|
then
|
|
echo error: directory $REFERENCEDIR not found
|
|
exit -1
|
|
fi
|
|
output=`ls $REFERENCEDIR | grep ".out\$"`
|
|
|
|
# check output files
|
|
echo " reference test diff."
|
|
for file in $output
|
|
do
|
|
# extract CPU time statistics
|
|
# convert from "1h23m45.6s" to seconds
|
|
tref=`awk '/CPU time/ \
|
|
{ str = $3; h = m = s = 0;
|
|
if (split(str, x, "h") == 2) { h = x[1]; str = x[2]; }
|
|
if (split(str, x, "m") == 2) { m = x[1]; str = x[2]; }
|
|
if (split(str, x, "s") == 2) { s = x[1]; str = x[2]; }
|
|
t += h * 3600 + m * 60 + s; }
|
|
END { printf("%.2f\n", t); }' \
|
|
$REFERENCEDIR/$file`
|
|
tres=`awk '/CPU time/ \
|
|
{ str = $3; h = m = s = 0;
|
|
if (split(str, x, "h") == 2) { h = x[1]; str = x[2]; }
|
|
if (split(str, x, "m") == 2) { m = x[1]; str = x[2]; }
|
|
if (split(str, x, "s") == 2) { s = x[1]; str = x[2]; }
|
|
t += h * 3600 + m * 60 + s; }
|
|
END { printf("%.2f\n", t); }' \
|
|
$RESULTSDIR/$file`
|
|
echo $file $tref $tres |
|
|
awk '{printf("%20s: %7.2f %7.2f %+6.1f%%\n",
|
|
$1, $2, $3, ($3/$2 - 1)*100)}'
|
|
totref=`echo $totref $tref | awk '{print $1+$2}'`
|
|
totres=`echo $totres $tres | awk '{print $1+$2}'`
|
|
done
|
|
echo "--------------------- ------ ------ ------"
|
|
echo $totref $totres |
|
|
awk '{printf("%20s: %7.2f %7.2f %+6.1f%%\n",
|
|
"total", $1, $2, ($2/$1 - 1)*100)}'
|
|
done
|