aboutsummaryrefslogtreecommitdiff
path: root/comparison/tools
diff options
context:
space:
mode:
Diffstat (limited to 'comparison/tools')
-rw-r--r--comparison/tools/sptest_commands.sh64
-rw-r--r--comparison/tools/sptest_commands.sh~58
-rw-r--r--comparison/tools/sptest_scripts.sh69
-rw-r--r--comparison/tools/sptest_scripts.sh~63
4 files changed, 254 insertions, 0 deletions
diff --git a/comparison/tools/sptest_commands.sh b/comparison/tools/sptest_commands.sh
new file mode 100644
index 0000000..d608d2c
--- /dev/null
+++ b/comparison/tools/sptest_commands.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+# $1: name list of commands
+# ex: ./sptest_commands.sh fib38 bsort-40000
+
+
+# repeat and waittimes
+ct=10
+waittime=5
+
+# etc
+log="log.txt"
+
+# -------------------------------------------------
+function mywait() {
+ for w in $(seq 1 $waittime) ; do
+ echo -n "."
+ sleep 1
+ done
+}
+
+function gettime() {
+ rm -f _result.txt
+ for i in $(seq 1 $ct) ; do
+ (time $1) 2>> _result.txt
+ echo
+ echo "Done ($i/$ct)"
+ if [[ $(($i + 1)) -le $ct ]]; then
+ mywait
+ echo 'Restart'
+ fi
+ done
+ echo
+ echo
+ logtime=`grep real _result.txt | cut -f2 | sed -e "s/\(.*\)m\(.*\)s/\1 \2/" | awk -F' ' '{print ($1*60+$2)}'`
+ echo "execution time"
+ echo "$logtime"
+
+ # for return value
+ res=`echo $logtime | awk 'BEGIN{r=0;c=0} {r=r+$0;c++} END{print r/c}'`
+ rm -f _result.txt
+}
+
+
+rm -f $log
+
+echo '' >> $log
+echo "$ct" | awk -F',' '{printf("%-27s| avg. time over %d runs (sec)\n","",$1)}' >> $log
+echo '===========================+=============================' >> $log
+
+for f in "$@"; do
+ command="$f"
+ echo -n "Cooling CPU in $waittime sec"
+ mywait
+ echo ' The experiment starts.'
+ echo "------------------"
+ echo "$f"
+ gettime "./$f"
+ echo "Average ${res}sec"
+ echo "$command,$res" | awk -F',' '{printf("%-27s| %.2f\n",$1,$2)}' >> $log
+done
+
+echo
+cat $log
+
diff --git a/comparison/tools/sptest_commands.sh~ b/comparison/tools/sptest_commands.sh~
new file mode 100644
index 0000000..0451c4e
--- /dev/null
+++ b/comparison/tools/sptest_commands.sh~
@@ -0,0 +1,58 @@
+#!/bin/bash
+# $1: name list of commands
+# ex: ./sptest_commands.sh fib38 bsort-40000
+
+
+# repeat and waittimes
+ct=10
+waittime=5
+
+# etc
+log="log.txt"
+
+# -------------------------------------------------
+function gettime() {
+ rm -f _result.txt
+ for ((i=1; i<ct; i++))
+ do
+ (time $1) 2>> _result.txt
+ echo
+ echo "Done ($i/$ct)"
+ sleep $waittime
+ echo 'Restart'
+ done
+ (time $1) 2>> _result.txt
+ echo
+ echo
+ logtime=`grep real _result.txt | awk -F'\t' '{print $2}' | cut -c3- | awk -F's' '{print $1}'`
+ echo "Execution times"
+ echo "$logtime"
+ res=`echo "$logtime\n" | awk 'BEGIN{r=0;c=0} {r=r+$0;c++} END{print r/c}'`
+
+ # for return value
+ res=`grep real _result.txt | awk -F'\t' '{print $2}' | cut -c3- | awk -F's' '{print $1}' | awk 'BEGIN{r=0;c=0} {r=r+$0;c++} END{print r/c}'`
+ rm -f _result.txt
+}
+
+
+rm -f $log
+
+echo '' >> $log
+echo "$ct" | awk -F',' '{printf("%-27s| avg. time over %d runs (sec)\n","",$1)}' >> $log
+echo '===========================+=============================' >> $log
+
+for f in "$@"; do
+ command="$f"
+ echo 'Now just cooling CPU...'
+ sleep $waittime
+ echo 'The experimental was started.'
+ echo "------------------"
+ echo "$f"
+ gettime "./$f"
+ echo "Average ${res}sec"
+ echo "$command,$res" | awk -F',' '{printf("%-27s| %.2f\n",$1,$2)}' >> $log
+done
+
+echo
+cat $log
+
diff --git a/comparison/tools/sptest_scripts.sh b/comparison/tools/sptest_scripts.sh
new file mode 100644
index 0000000..7d384fe
--- /dev/null
+++ b/comparison/tools/sptest_scripts.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+# $1: executable file name
+# $2: name list of script files
+# ex: ./sptest_scripts.sh sml 'fib5.sml fib10.sml'
+# Then, 'sml < fib5.sml' and "sml < fib10.sml' are executed.
+
+
+# repeat and waittimes
+ct=10
+waittime=5
+
+# etc
+comf=$1
+log="log.txt"
+sfs=($2); # sourcefiles
+
+# -------------------------------------------------
+function mywait() {
+ for w in $(seq 1 $waittime) ; do
+ echo -n "."
+ sleep 1
+ done
+}
+
+function gettime() {
+ rm -f _result.txt
+ for i in $(seq 1 $ct) ; do
+ (time $1 < $2) 2>> _result.txt
+ echo
+ echo -n "Done ($i/$ct)"
+ if [[ $(($i + 1)) -le $ct ]]; then
+ mywait
+ echo 'Restart'
+ fi
+ done
+ echo
+ echo
+ logtime=`grep real _result.txt | cut -f2 | sed -e "s/\(.*\)m\(.*\)s/\1 \2/" | awk -F' ' '{print ($1*60+$2)}'`
+ echo "execution time"
+ echo "$logtime"
+
+ # for return value
+ res=`echo $logtime | awk 'BEGIN{r=0;c=0} {r=r+$0;c++} END{print r/c}'`
+ rm -f _result.txt
+}
+
+
+rm -f $log
+
+echo '' >> $log
+echo "$ct" | awk -F',' '{printf("%-27s| avg. time over %d runs (sec)\n","",$1)}' >> $log
+echo '===========================+=============================' >> $log
+
+for f in "${sfs[@]}"
+do
+ command="$f"
+ echo -n "Cooling CPU in $waittime sec"
+ mywait
+ echo ' The experiment starts.'
+ echo "------------------"
+ echo "$comf < $f"
+ gettime "$comf" "$f"
+ echo "Average ${res}sec"
+ echo
+ echo "$command,$res" | awk -F',' '{printf("%-27s| %.2f\n",$1,$2)}' >> $log
+done
+echo
+cat $log
+
diff --git a/comparison/tools/sptest_scripts.sh~ b/comparison/tools/sptest_scripts.sh~
new file mode 100644
index 0000000..2d543d0
--- /dev/null
+++ b/comparison/tools/sptest_scripts.sh~
@@ -0,0 +1,63 @@
+#!/bin/bash
+# $1: executable file name
+# $2: name list of script files
+# ex: ./sptest_scripts.sh sml 'fib5.sml fib10.sml'
+# Then, 'sml < fib5.sml' and "sml < fib10.sml' are executed.
+
+
+# repeat and waittimes
+#ct=10
+ct=1
+waittime=5
+
+# etc
+comf=$1
+log="log.txt"
+sfs=($2); # sourcefiles
+
+# -------------------------------------------------
+function gettime() {
+ rm -f _result.txt
+ for ((i=1; i<ct; i++))
+ do
+ (time $1 < $2) 2>> _result.txt
+ echo
+ echo "Done ($i/$ct)"
+ sleep $waittime
+ echo 'Restart'
+ done
+ (time $1 < $2) 2>> _result.txt
+ echo
+ echo
+ logtime=`grep real _result.txt | cut -f2 | sed -e "s/\(.*\)m\(.*\)s/\1 \2/" | awk -F' ' '{print ($1*60+$2)}'`
+ echo "Execution times"
+ echo "$logtime"
+ res=`echo "$logtime\n" | awk 'BEGIN{r=0;c=0} {r=r+$0;c++} END{print r/c}'`
+
+ # for return value
+ res=`grep real _result.txt | awk -F'\t' '{print $2}' | cut -c3- | awk -F's' '{print $1}' | awk 'BEGIN{r=0;c=0} {r=r+$0;c++} END{print r/c}'`
+ rm -f _result.txt
+}
+
+
+rm -f $log
+
+echo '' >> $log
+echo "$ct" | awk -F',' '{printf("%-27s| avg. time over %d runs (sec)\n","",$1)}' >> $log
+echo '===========================+=============================' >> $log
+
+for f in "${sfs[@]}"
+do
+ command="$f"
+ echo 'Now just cooling CPU...'
+ sleep $waittime
+ echo 'The experimental was started.'
+ echo "------------------"
+ echo "$comf < $f"
+ gettime "$comf" "$f"
+ echo "Average ${res}sec"
+ echo "$command,$res" | awk -F',' '{printf("%-27s| %.2f\n",$1,$2)}' >> $log
+done
+echo
+cat $log
+