diff --git a/.gitignore b/.gitignore index f88355f5defab479b9c0c4c85a715133707fdec7..fb87ea4e037b72e38c0da16b7bbf0b2279f32351 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,5 @@ a.out *.in test tests/*.txt -tests/tempos.png +tests/*.png massif.out* diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5eac29929d61ca687af62dabfa13d75d241e39bd..11e93969ad81d0b0a62f742653b21d2b499bc284 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,10 +12,13 @@ test: - make test - cd tests - gnuplot "tempos.plot" + - gnuplot medias.plot artifacts: paths: - tests/tabuleiros.txt - tests/tempos.txt + - tests/medias.txt - tests/tempos.png + - tests/medias.png tags: - ubuntu diff --git a/Makefile b/Makefile index 55f097af98a9ef8e877bf788c1c02ddde70826a1..595e6e7886df1f8f992f27e83e2feb345b922627 100644 --- a/Makefile +++ b/Makefile @@ -16,4 +16,4 @@ main: main.c libs/tabuleiro.o libs/grafo.o libs/vertice.o libs/filha.o libs/list clean: $(RM) *.o $(RM) libs/*.o - $(RM) tests/*.in + $(RM) tests/*.time diff --git a/tests/medias.plot b/tests/medias.plot new file mode 100644 index 0000000000000000000000000000000000000000..80ca5ed35811fa425894e3539b3f127859d748b6 --- /dev/null +++ b/tests/medias.plot @@ -0,0 +1,9 @@ +set terminal png +set output "medias.png" +set xlabel "Tamanho" +set ylabel "Tempo (milisegundos)" +set title "Tempo médio para execução considerando tamanho do tabuleiro" +set grid +set key +set pointintervalbox 3 +plot "medias.txt" using 1:2 with linespoints lc rgb "#602b7d" lw 2 pt 7 lt 1 pi -1 ps 1.5 diff --git a/tests/runTests.sh b/tests/runTests.sh index 5c5b48209da6e643e7a19a53b870247de9150776..41ab99f7250cac51d923446a10a0873e050ec5e3 100755 --- a/tests/runTests.sh +++ b/tests/runTests.sh @@ -4,7 +4,7 @@ tempo_max=10000 #10s # tamanhos do tabuleiro -tams=(4 8 16 32 50 64 80 92 100) +tams=(4 8 16 25 32 50 64 75 100 128) # lista de cores cores=(2 3 4 5 6 7 8) @@ -17,7 +17,8 @@ CYAN='\033[0;36m' NC='\033[0m' # Sem cor echo -ne "" > tabuleiros.txt -echo -ne "" > tempos.txt +echo -ne "#Tam tabuleiro\t#N cores\t#Tempo médio\n" > tempos.txt +echo -ne "#Tam tabuleiro\t#Tempo médio\n" > medias.txt echo "Iniciado testes" for i in ${tams[*]} @@ -55,14 +56,15 @@ do echo -ne "\n${CYAN}Tempo médio com ${cor} cores: ${S_medio_cor}." printf "%03d" ${M_medio_cor} echo -e "s (${T_medio_cor})${NC}\n" + echo -e "${i}\t${cor}\t${M_medio_cor}" >> tempos.txt done T_medio_total=$(( $T_soma_total/($i * ${#cores[*]}) )) S_medio_total=$(($T_medio_total/1000000000)) M_medio_total=$(($T_medio_total/1000000)) echo -ne "${BLUE}Tempo médio com tamanho ${i}: ${S_medio_total}." printf "%03d" ${M_medio_total} - echo -e "s (${T_medio_cor})${NC}\n" - echo -e "${i} \t ${M_medio_total}" >> tempos.txt + echo -e "s (${T_medio_total})${NC}\n" + echo -e "${i}\t${M_medio_total}" >> medias.txt done fs=$(cat tabuleiros.txt | wc -l) diff --git a/tests/tempos.plot b/tests/tempos.plot index b8500d5ece5296a4ac1bbeea8ec647fb612ca2cd..42b7d805f9ef409d520c7582e2ae3cb522f7d08a 100644 --- a/tests/tempos.plot +++ b/tests/tempos.plot @@ -1,9 +1,20 @@ set terminal png set output "tempos.png" -set xlabel "Tamanho" +set xlabel "Cores" set ylabel "Tempo (milisegundos)" -set title "Tempo médio para execução considerando tamanho do tabuleiro e tempo" +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') +select_source(w) = sprintf('< awk ''{if ($1 == "%s") print }'' %s', w, filename) + set grid -set style data lines set key -plot "tempos.txt" using 1:2 with lines lc rgb "#602b7d" lw 2 +set style data linespoints +set pointintervalbox 3 + +plot for [f in from] select_source(f) using 2: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"