From f5d985952655fa4c0c483a0eb94251703952436d Mon Sep 17 00:00:00 2001
From: Armando Luiz Nicolini Delgado <nicolui@inf.ufpr.br>
Date: Wed, 25 Oct 2023 09:14:10 -0300
Subject: [PATCH] =?UTF-8?q?/*=20*=20Em=20gnuplot:=20alterar=20exemplos=20d?=
 =?UTF-8?q?e=20plotagem=20para=20mostrar:=20=20=20=20=20=20-=20posicioname?=
 =?UTF-8?q?nto=20de=20legendas=20=20=20=20=20=20-=20Curvas=20de=20diferent?=
 =?UTF-8?q?es=20tabelas=20em=20um=20mesmo=20gr=C3=A1fico=20=20=20=20=20=20?=
 =?UTF-8?q?-=20definir=20cores=20de=20curvas=20=20=20=20=20=20-=20Como=20p?=
 =?UTF-8?q?lotar=20tabelas=20com=20colunas=20separadas=20por=20','=20ou=20?=
 =?UTF-8?q?por=20'=20'=20(espa=C3=A7o)=20=20=20*=20Em=20utils.c:=20=20=20?=
 =?UTF-8?q?=20=20-=20tipo=20double=20para=20tempo=20substitu=C3=ADdo=20pel?=
 =?UTF-8?q?o=20typedef=20'rtime=5Ft'=20(vide=20utils.h)=20*/?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 gnuplot/plot.gp             | 17 ++++++++++++++---
 gnuplot/plot_exemplo-01.dat | 10 +++++-----
 gnuplot/plot_exemplo-02.dat | 10 +++++-----
 utils/utils.c               |  4 ++--
 4 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/gnuplot/plot.gp b/gnuplot/plot.gp
index dc01ef4..103b0b2 100755
--- a/gnuplot/plot.gp
+++ b/gnuplot/plot.gp
@@ -1,8 +1,12 @@
 #!/usr/bin/gnuplot -c
+
 ## set encoding iso_8859_15
 set encoding utf
-set terminal qt persist
+
+# set terminal qt persist
+
 set grid
+
 set style data point
 set style function line
 set style line 1 lc 3 pt 7 ps 0.3
@@ -14,17 +18,24 @@ set xlabel  "N (bytes)"
 #
 # ALTERNATIVA 1: Tabelas em arquivos separados (2 colunas)
 #
+set key center center # posição da legenda: center, left, right
+set datafile separator comma
 set ylabel  "<metrica 1>"
+set logscale x
 set title   "<campo[marcador 1]>"
 set terminal qt 0 title "<campo[marcador 1]>"
-plot 'plot_exemplo-01.dat' title "<sem otimização>" with linespoints, \
-     'plot_exemplo-02.dat' title "<com otimização>" with linespoints
+plot 'plot_exemplo-01.dat' using 1:2 title "<sem otimização>" lc rgb "green" with linespoints, \
+     '' using 1:3 title "<com otimização>" lc rgb "blue" with linespoints, \
+     'plot_exemplo-02.dat' title "<com avx>" lc rgb "red" with linespoints
 
 pause -1
 
 #
 # ALTERNATIVA 2: Tabela com 3 colunas 
 #
+set key outside right # posição da legenda: outside {left | right}
+unset logscale x
+set datafile separator whitespace
 set ylabel  "<metrica 1>"
 set title   "<campo[marcador 1]>"
 set terminal qt 1 title "<campo[marcador 1]>"
diff --git a/gnuplot/plot_exemplo-01.dat b/gnuplot/plot_exemplo-01.dat
index 80be8a9..9bea290 100644
--- a/gnuplot/plot_exemplo-01.dat
+++ b/gnuplot/plot_exemplo-01.dat
@@ -1,7 +1,7 @@
 # Marcador "matPtrVet"
 # n <METRICA 1> (sem otimização)
-64 0.5
-100 50.433210629261
-128  25.798359943835
-2000 27.337482595053
-2048 18.873424079086
+64,1.1,0.5
+100,50.433210629261,45.433210629261
+128,25.798359943835,21.798359943835
+2000,27.337482595053,21.337482595053
+2048,18.873424079086,14.873424079086
diff --git a/gnuplot/plot_exemplo-02.dat b/gnuplot/plot_exemplo-02.dat
index d5c852b..cef04aa 100644
--- a/gnuplot/plot_exemplo-02.dat
+++ b/gnuplot/plot_exemplo-02.dat
@@ -1,7 +1,7 @@
 # Marcador "matPtrVet"
 # n <METRICA 1> (com otimização)
-64 0.5
-100 45.433210629261
-128  21.798359943835
-2000 21.337482595053
-2048 14.873424079086
+64,0.8
+100,35.433210629261
+128,18.798359943835
+2000,25.337482595053
+2048,10.873424079086
diff --git a/utils/utils.c b/utils/utils.c
index eeb7e4e..1035eb5 100644
--- a/utils/utils.c
+++ b/utils/utils.c
@@ -8,7 +8,7 @@
 
     Forma de uso:
  
-    double tempo;
+    rtime_t tempo;
     tempo = timestamp();
     <trecho de programa do qual se deseja medir tempo>
     tempo = timestamp() - tempo;
@@ -55,7 +55,7 @@ int isPot2(int n)
 
     Forma de uso:
  
-    double tempo;
+    rtime_t tempo;
     tempo = timestamp();
     <trecho de programa do qual se deseja medir tempo>
     tempo = timestamp() - tempo;
-- 
GitLab