diff --git a/tests/runTests.sh b/tests/runTests.sh index 41ab99f7250cac51d923446a10a0873e050ec5e3..9cb373fe90bba13eaa118aff73cf0966172b60c2 100755 --- a/tests/runTests.sh +++ b/tests/runTests.sh @@ -7,7 +7,7 @@ tempo_max=10000 #10s tams=(4 8 16 25 32 50 64 75 100 128) # lista de cores -cores=(2 3 4 5 6 7 8) +cores=(2 3 4 5 6 7 8 16 32) #-- Cores do terminal RED='\033[0;31m' @@ -29,9 +29,12 @@ do do echo "Número de cores: ${cor}" T_soma_cor=0 + T_max_cor=0 for j in $(seq 1 $i) do - echo -ne "Tabuleiro com ${i} linhas e ${cor} cores ${i}x${j}"\\r + echo -ne "Tabuleiro com ${i} linhas e ${cor} cores: ${i}x${j} (T max: $(($T_max_cor/1000000000))." + printf "%03d" $(($T_max_cor/1000000)) + echo -ne ")"\\r semente=$RANDOM # echo "Usando semente: ${semente}" ./test $i $j $cor $semente @@ -44,6 +47,10 @@ do S=$(($T_gasto/1000000000)) # tempo em milisegundos M=$(($T_gasto/1000000)) + # tempo máximo por cor + if [ $T_max_cor -lt $T_gasto ]; then + T_max_cor=$T_gasto + fi if (($M>$tempo_max)); then echo -e "\n${RED}Tabuleiro ${i} ${j} ${cor} ${semente} levou mais de ${tempo_max} milisegundos: ${S}.${M}s${NC}" echo "${i} ${j} ${cor} ${semente}" >> tabuleiros.txt diff --git a/tests/tempos.plot b/tests/tempos.plot index 42b7d805f9ef409d520c7582e2ae3cb522f7d08a..05d8631dc45e315faffb4ae9f64d4c381aeb12f4 100644 --- a/tests/tempos.plot +++ b/tests/tempos.plot @@ -1,20 +1,27 @@ -set terminal png +set terminal png size 800,800 set output "tempos.png" -set xlabel "Cores" -set ylabel "Tempo (milisegundos)" -set title "Tempo médio para execução considerando número de cores e tamanho do tabuleiro" filename="tempos.txt" -from=system('tail -n +2 '.filename. '| cut -f 1 | sort | uniq') + +from=system('tail -n +2 '.filename. '| cut -f 1 | sort -n | uniq') select_source(w) = sprintf('< awk ''{if ($1 == "%s") print }'' %s', w, filename) +from2=system('tail -n +2 '.filename. '| cut -f 2 | sort -n | uniq') +select_source2(w) = sprintf('< awk ''{if ($2 == "%s") print }'' %s', w, filename) + set grid set key set style data linespoints set pointintervalbox 3 +set multiplot layout 2,1 +set title "Tempo médio para execução\n considerando número de cores" +set xlabel "Cores" +set ylabel "Tempo médio (milisegundos)" plot for [f in from] select_source(f) using 2:3 title f +set title "Tempo médio para execução\n considerando tamanho do tabuleiro" +set xlabel "Tamanho do Tabuleiro" +plot for [f in from2] select_source2(f) using 1:3 title f -#plot "tempos.txt" using 1:3 with points lc rgb "#602b7d" lw 2 title "Tamanho do tabuleiro",\ -# "tempos.txt" using 2:3 with points lc rgb "#19e287" lw 2 title "Número de cores" +unset multiplot