Mercurial > hg > CbC > CbC_gcc
comparison CbC-examples/quicksort/benchmark.sh @ 43:607e6dc322e5
modify quicksort.
author | kent <kent@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 Jan 2010 17:26:06 +0900 |
parents | |
children | 689bf9141c8c |
comparison
equal
deleted
inserted
replaced
41:c816ae4380d7 | 43:607e6dc322e5 |
---|---|
1 #!/usr/bin/env zsh | |
2 | |
3 time=/usr/bin/time | |
4 QS=./quicksort_cbc | |
5 size=10000000 | |
6 seed=123456789 | |
7 num=10 | |
8 | |
9 | |
10 max=0 | |
11 min=99999 | |
12 count=0 | |
13 amount=0 | |
14 | |
15 echo "size of array = $size" | |
16 while [[ $count -lt $num ]]; do | |
17 usertime=$( $time -p $QS -n $size -s $seed 2>&1 >& - |grep '^user'|tr -s " "|cut -f2 -d" ") | |
18 #usertime=$(printf "%d" $usertime) | |
19 echo $usertime | |
20 | |
21 amount=$(($usertime+$amount)) | |
22 if [[ $usertime -lt $min ]]; then | |
23 min=$usertime | |
24 fi | |
25 if [[ $usertime -gt $max ]]; then | |
26 max=$usertime | |
27 fi | |
28 #seed=$seed[1,-2] | |
29 seed=$(($seed+10)) | |
30 count=$(($count+1)) | |
31 done | |
32 | |
33 echo "amount time = $amount" | |
34 echo "maxtime = $max" | |
35 echo "mintime = $min" | |
36 | |
37 amount=$(($amount - $max - $min)) | |
38 echo "amount time - mintime - maxtime = $amount" | |
39 count=$(($count-2)) | |
40 echo "count = $count" | |
41 averagetime=$(($amount/($count))) | |
42 echo "average time = $averagetime" | |
43 | |
44 |