changeset 92:689bf9141c8c

add conv1/benchmark.sh
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Wed, 04 Jan 2012 02:15:01 +0900
parents 0a063106bba9
children 0b0b0782e795
files CbC-examples/conv1/benchmark.sh CbC-examples/quicksort/benchmark.sh
diffstat 2 files changed, 38 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CbC-examples/conv1/benchmark.sh	Wed Jan 04 02:15:01 2012 +0900
@@ -0,0 +1,37 @@
+#!/usr/bin/env zsh
+
+time=/usr/bin/time
+CONV1=./conv1
+num=10
+
+count=0
+amount=0
+
+echo "$CONV1 $1"
+while [[ $count -lt $num ]]; do
+    # /usr/bin/time -p ./conv1 1 2>&1 >& - |grep '^user'|tr -s " "|cut -f2 -d" "
+    usertime=$( $time -p $CONV1 1 2>&1 >& - |grep '^user'|tr -s " " |cut -f2 -d" ")
+    echo $usertime
+
+    amount=$(($usertime+$amount))
+    if [[ $usertime -lt $min ]]; then
+	min=$usertime
+    fi
+    if [[ $usertime -gt $max ]]; then
+	max=$usertime
+    fi
+    count=$(($count+1))
+done
+
+echo "amount time = $amount"
+echo "maxtime = $max"
+echo "mintime = $min"
+
+
+amount=$(($amount - $max - $min))
+echo "amount time - mintime - maxtime = $amount"
+#count=$(($count-2))
+echo "count = $count"
+averagetime=$(($amount/($count)))
+echo "average time = $averagetime"
+
--- a/CbC-examples/quicksort/benchmark.sh	Sun Dec 25 04:17:22 2011 +0900
+++ b/CbC-examples/quicksort/benchmark.sh	Wed Jan 04 02:15:01 2012 +0900
@@ -14,6 +14,7 @@
 
 echo "size of array = $size"
 while [[ $count -lt $num ]]; do
+        echo "$time -p $QS -n $size -s $seed 2>&1 >& - |grep '^user'|tr -s \" \"|cut -f2 -d\" \" "
 	usertime=$( $time -p $QS -n $size -s $seed 2>&1 >& - |grep '^user'|tr -s " "|cut -f2 -d" ")
 	#usertime=$(printf "%d" $usertime)
 	echo $usertime