diff CbC-examples/conv1/benchmark.sh @ 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
children 0b0b0782e795
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"
+