Mercurial > hg > CbC > CbC_gcc
changeset 43:607e6dc322e5
modify quicksort.
author | kent <kent@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 Jan 2010 17:26:06 +0900 |
parents | c816ae4380d7 |
children | a14cd9f25ac4 |
files | CbC-examples/quicksort/benchmark.sh |
diffstat | 1 files changed, 44 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CbC-examples/quicksort/benchmark.sh Mon Jan 25 17:26:06 2010 +0900 @@ -0,0 +1,44 @@ +#!/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 + 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" + +