Skip to content
Snippets Groups Projects
Commit 316387f3 authored by Vytor Calixto's avatar Vytor Calixto :space_invader:
Browse files

Add plots melhores

parent b920d518
Branches
No related tags found
No related merge requests found
Pipeline #
...@@ -5,5 +5,5 @@ a.out ...@@ -5,5 +5,5 @@ a.out
*.in *.in
test test
tests/*.txt tests/*.txt
tests/tempos.png tests/*.png
massif.out* massif.out*
...@@ -12,10 +12,13 @@ test: ...@@ -12,10 +12,13 @@ test:
- make test - make test
- cd tests - cd tests
- gnuplot "tempos.plot" - gnuplot "tempos.plot"
- gnuplot medias.plot
artifacts: artifacts:
paths: paths:
- tests/tabuleiros.txt - tests/tabuleiros.txt
- tests/tempos.txt - tests/tempos.txt
- tests/medias.txt
- tests/tempos.png - tests/tempos.png
- tests/medias.png
tags: tags:
- ubuntu - ubuntu
...@@ -16,4 +16,4 @@ main: main.c libs/tabuleiro.o libs/grafo.o libs/vertice.o libs/filha.o libs/list ...@@ -16,4 +16,4 @@ main: main.c libs/tabuleiro.o libs/grafo.o libs/vertice.o libs/filha.o libs/list
clean: clean:
$(RM) *.o $(RM) *.o
$(RM) libs/*.o $(RM) libs/*.o
$(RM) tests/*.in $(RM) tests/*.time
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
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
tempo_max=10000 #10s tempo_max=10000 #10s
# tamanhos do tabuleiro # 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 # lista de cores
cores=(2 3 4 5 6 7 8) cores=(2 3 4 5 6 7 8)
...@@ -17,7 +17,8 @@ CYAN='\033[0;36m' ...@@ -17,7 +17,8 @@ CYAN='\033[0;36m'
NC='\033[0m' # Sem cor NC='\033[0m' # Sem cor
echo -ne "" > tabuleiros.txt 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" echo "Iniciado testes"
for i in ${tams[*]} for i in ${tams[*]}
...@@ -55,14 +56,15 @@ do ...@@ -55,14 +56,15 @@ do
echo -ne "\n${CYAN}Tempo médio com ${cor} cores: ${S_medio_cor}." echo -ne "\n${CYAN}Tempo médio com ${cor} cores: ${S_medio_cor}."
printf "%03d" ${M_medio_cor} printf "%03d" ${M_medio_cor}
echo -e "s (${T_medio_cor})${NC}\n" echo -e "s (${T_medio_cor})${NC}\n"
echo -e "${i}\t${cor}\t${M_medio_cor}" >> tempos.txt
done done
T_medio_total=$(( $T_soma_total/($i * ${#cores[*]}) )) T_medio_total=$(( $T_soma_total/($i * ${#cores[*]}) ))
S_medio_total=$(($T_medio_total/1000000000)) S_medio_total=$(($T_medio_total/1000000000))
M_medio_total=$(($T_medio_total/1000000)) M_medio_total=$(($T_medio_total/1000000))
echo -ne "${BLUE}Tempo médio com tamanho ${i}: ${S_medio_total}." echo -ne "${BLUE}Tempo médio com tamanho ${i}: ${S_medio_total}."
printf "%03d" ${M_medio_total} printf "%03d" ${M_medio_total}
echo -e "s (${T_medio_cor})${NC}\n" echo -e "s (${T_medio_total})${NC}\n"
echo -e "${i} \t ${M_medio_total}" >> tempos.txt echo -e "${i}\t${M_medio_total}" >> medias.txt
done done
fs=$(cat tabuleiros.txt | wc -l) fs=$(cat tabuleiros.txt | wc -l)
......
set terminal png set terminal png
set output "tempos.png" set output "tempos.png"
set xlabel "Tamanho" set xlabel "Cores"
set ylabel "Tempo (milisegundos)" 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 grid
set style data lines
set key 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"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment