2 # This file is part of NIT ( http://www.nitlanguage.org ).
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # This shell script generate gnuplot results
18 # perl function to compute min/max/avg.
19 # used by bench_command
22 # return: first min max avg label
23 function compute_stats
()
27 perl
- "$file" <<'END'
43 @lines
= sort {$a <=> $b} @lines
;
45 $max = $lines[$#lines];
47 for $i (@lines
) { $avg += $i; }
49 print
"${first} ${min} ${max} ${avg} \"${label}\"\n";
51 print
"${first} ${first} ${first} ${first} \"${label}\"\n";
56 # Create a new $res to be used in the next plot
61 function prepare_res
()
66 if [ "$plots" = "" ]; then
67 plots
="plot '$1' using 4:2:3:xticlabels(5) ti '$2';"
69 plots
="$plots replot '$1' using 4:2:3 ti '$2';"
71 if [ "$dry_run" = "true" ]; then return; fi
72 echo "# [$2] $3 ; count=$count" > "$res"
73 echo "# first min max avg title" >> "$res"
76 # Plot the last $res as an histogram
77 # $1: plot file (eg toto.gnu)
83 set style data histogram
;
84 set style histogram cluster gap
2;
85 set style histogram errorbars linewidth
1;
86 set style fill solid
0.3 border
-1;
89 set xtic nomirror rotate by
-45 scale
0 font
',8';
90 set title
"$1 ; avg. on $count-1 runs"
94 echo "# gnuplot -p $1"
99 ## GLOBAL VARIABLES ##
101 # The current $res (set by prepare_res, used by bench_command)
104 # The current stuff to plot (set by prepare_res, used by plot)