2
|
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
|