Mercurial > hg > CbC > CbC_examples
view quicksort/benchmark.sh @ 2:35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 22 Oct 2014 02:06:29 +0900 |
parents | bacef8675607 |
children |
line wrap: on
line source
#!/usr/bin/env zsh time=/usr/bin/time QS=./quicksort_cbc size=10000000 seed=123456789 num=10 max=0 min=99999 count=0 amount=0 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 amount=$(($usertime+$amount)) if [[ $usertime -lt $min ]]; then min=$usertime fi if [[ $usertime -gt $max ]]; then max=$usertime fi #seed=$seed[1,-2] seed=$(($seed+10)) 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"