blob: 65aaf66f9612f3f333cb6dd931af95f81aa5c457 [file] [log] [blame]
Austin Schuhc55b0172022-02-20 17:52:35 -08001#!/bin/bash
2
3# base name of the bench
4# it reads $1.out
5# and generates $1.pdf
6WHAT=$1
7bench=$2
8settings_file=$3
9
10header="rev "
11while read line
12do
13 if [ ! -z '$line' ]; then
14 header="$header \"$line\""
15 fi
16done < $settings_file
17
18echo $header > $WHAT.out.header
19cat $WHAT.out >> $WHAT.out.header
20
21
22echo "set title '$WHAT'" > $WHAT.gnuplot
23echo "set key autotitle columnhead outside " >> $WHAT.gnuplot
24echo "set xtics rotate 1" >> $WHAT.gnuplot
25
26echo "set term pdf color rounded enhanced fontscale 0.35 size 7in,5in" >> $WHAT.gnuplot
27echo set output "'"$WHAT.pdf"'" >> $WHAT.gnuplot
28
29col=`cat $settings_file | wc -l`
30echo "plot for [col=2:$col+1] '$WHAT.out.header' using 0:col:xticlabels(1) with lines" >> $WHAT.gnuplot
31echo " " >> $WHAT.gnuplot
32
33gnuplot -persist < $WHAT.gnuplot
34
35# generate a png file (thumbnail)
36convert -colors 256 -background white -density 300 -resize 300 -quality 0 $WHAT.pdf -background white -flatten $WHAT.png
37
38# clean
39rm $WHAT.out.header $WHAT.gnuplot
40
41
42# generate html/svg graph
43
44echo " " > $WHAT.html
45cat resources/chart_header.html > $WHAT.html
46echo 'var customSettings = {"TITLE":"","SUBTITLE":"","XLABEL":"","YLABEL":""};' >> $WHAT.html
47# 'data' is an array of datasets (i.e. curves), each of which is an object of the form
48# {
49# key: <name of the curve>,
50# color: <optional color of the curve>,
51# values: [{
52# r: <revision number>,
53# v: <GFlops>
54# }]
55# }
56echo 'var data = [' >> $WHAT.html
57
58col=2
59while read line
60do
61 if [ ! -z '$line' ]; then
62 header="$header \"$line\""
63 echo '{"key":"'$line'","values":[' >> $WHAT.html
64 i=0
65 while read line2
66 do
67 if [ ! -z "$line2" ]; then
68 val=`echo $line2 | cut -s -f $col -d ' '`
69 if [ -n "$val" ]; then # skip build failures
70 echo '{"r":'$i',"v":'$val'},' >> $WHAT.html
71 fi
72 fi
73 ((i++))
74 done < $WHAT.out
75 echo ']},' >> $WHAT.html
76 fi
77 ((col++))
78done < $settings_file
79echo '];' >> $WHAT.html
80
81echo 'var changesets = [' >> $WHAT.html
82while read line2
83do
84 if [ ! -z '$line2' ]; then
85 echo '"'`echo $line2 | cut -f 1 -d ' '`'",' >> $WHAT.html
86 fi
87done < $WHAT.out
88echo '];' >> $WHAT.html
89
90echo 'var changesets_details = [' >> $WHAT.html
91while read line2
92do
93 if [ ! -z '$line2' ]; then
94 num=`echo "$line2" | cut -f 1 -d ' '`
95 comment=`grep ":$num" changesets.txt | cut -f 2 -d '#'`
96 echo '"'"$comment"'",' >> $WHAT.html
97 fi
98done < $WHAT.out
99echo '];' >> $WHAT.html
100
101echo 'var changesets_count = [' >> $WHAT.html
102i=0
103while read line2
104do
105 if [ ! -z '$line2' ]; then
106 echo $i ',' >> $WHAT.html
107 fi
108 ((i++))
109done < $WHAT.out
110echo '];' >> $WHAT.html
111
112cat resources/chart_footer.html >> $WHAT.html