From 36c8811c57434d275c12398d6b9049490546674d Mon Sep 17 00:00:00 2001
From: Arnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Date: Sat, 2 Mar 2013 23:16:36 +0100
Subject: [PATCH] Add the possibility to give a filtering RE on command line.

---
 supercomp11/data/interactive_plot | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/supercomp11/data/interactive_plot b/supercomp11/data/interactive_plot
index ccfedc0..b61b0c0 100755
--- a/supercomp11/data/interactive_plot
+++ b/supercomp11/data/interactive_plot
@@ -13,16 +13,16 @@ toclean+=( $tmpA )
 tmpB=$(mktemp)
 toclean+=( $tmpB )
 
-grep '_[IR]N_.*bookkeeping' alldata > $tmpA
+RE=${1:-_R[1N]_}
 
-for type in I R; do
+grep -e "$RE" alldata > $tmpA
+
+for type in {I,R}{1,N}; do
     for ratio in 10:1 1:1 1:10; do
         for platf in cluster grid; do
             for topo in line torus hcube; do
-                title="results_${type}N_${ratio}/plat_${platf}/topo_${topo}"
-                echo "===[ $title ]==="
                 < $tmpA awk \
-                    -v re="^results_${type}N_${ratio}/plat_${platf}[0-9]+/topo_${topo}" \
+                    -v re="^results_${type}_${ratio}/plat_${platf}[0-9]+/topo_${topo}" \
 '
 $0 ~ re {
     split($1, cfg, "/");
@@ -51,21 +51,27 @@ $0 ~ re {
 }
 ' \
                 > $tmpB
+                if [ ! -s $tmpB ]; then
+                    continue
+                fi
+                title="results_${type}_${ratio}/plat_${platf}/topo_${topo}"
+                echo "===[ $title ]==="
+                nb=$(expr $(grep -c ^algo $tmpB) - 1)
 if true; then
                 ### show conv max
                 gnuplot \
                     -e "set title '$title'" \
                     -e "plot
-for [i=0:3] '$tmpB' index i using 1:4 with linespoint ls i+1 title column(1)" \
+for [i=0:$nb] '$tmpB' index i using 1:4 with linespoint ls i+1 title column(1)" \
                     -e "pause mouse"
 else
                 ### all idle avg; conv avg; conv max
                 gnuplot \
                     -e "set title '$title'" \
                     -e "plot
-for [i=0:3] '$tmpB' index i using 1:4 with linespoint ls i+1 title column(1),
-for [i=0:3] '$tmpB' index i using 1:3 with linespoint ls i+1 notitle,
-for [i=0:3] '$tmpB' index i using 1:2 with linespoint ls i+1 notitle" \
+for [i=0:$nb] '$tmpB' index i using 1:4 with linespoint ls i+1 title column(1),
+for [i=0:$nb] '$tmpB' index i using 1:3 with linespoint ls i+1 notitle,
+for [i=0:$nb] '$tmpB' index i using 1:2 with linespoint ls i+1 notitle" \
                     -e "pause mouse"
 fi
             done
-- 
2.39.5