#!/bin/sh # name : scaletest.sh # author : Craig Shallahamer, craig@orapub.com # original : 8-June-2011 # warrenty : Absolutely no warrenty of any kind. Use at own risk. # purpose : This script will help one to understand the relationship # between cores, threads, and elapsed time. maxprocs=10 # You will want a value greater then the number of # max(total cores, total threads). maxsamples=31 # Do at least 30. relax=3 # Let the system calm down before getting stats. vmsleep=30 # this value needs to be less then the time it takes # to run the bc for loop serially. tmpfile=/tmp/OPvmstat.tmp finalfile=./finaloutput.txt rm -f $finalfile date for ((sample=1;sample<=$maxsamples;sample++)) do for ((procs=1;procs<=$maxprocs;procs++)) do echo -n "sample=$sample procs=$procs ... " start=`date +%s` for ((p=1;p<=$procs;p++)) do # You may need to increase the 9's so the serial duration is # at least long than the vmsleep setting. The long this takes and # the longer the vmsleep is the more steady the final results will be. echo "scale=12;for(x=0;x<39999999;++x){1+1.243;}" | bc >/dev/null & done sleep $relax vmstat $vmsleep 2 > $tmpfile util=`cat $tmpfile | head -4 | tail -1 | awk '{print $13+$14}'` runq=`cat $tmpfile | head -4 | tail -1 | awk '{print $1}'` wait stop=`date +%s` dur=`echo "$stop-$start" | bc` echo " $dur seconds util=$util runq=$runq " #echo "FINAL: $sample,$procs,$dur,$util,$runq" echo "$sample,$procs,$dur,$util,$runq" >> $finalfile sleep $relax #ps -eaf|grep findprimes|wc -l done done echo "" echo "------------------------" cat $finalfile echo "------------------------" date echo "**** DONE ****"