-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_plot.sh
executable file
·102 lines (93 loc) · 2.58 KB
/
make_plot.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
NL=`wc -l < ./reports/all_4_plot.txt`
# Plotting individual forkbench result
for (( ii=1; ii<=${NL}; ii++ ))
do
if [ $((ii%3)) -eq 2 ]
then
PLOTNAME=`sed -n "$((ii-1))p" < ./reports/all_4_plot.txt`
sed -n "${ii}p;$((ii+1))p" < ./reports/all_4_plot.txt | awk '
{
for (i=1; i<=NF; i++) {
a[NR,i] = $i
}
}
NF>p { p = NF }
END {
for(j=1; j<=p; j++) {
str=a[1,j]
for(i=2; i<=NR; i++){
str=str" "1/a[i,j];
}
print str
}
}' | gnuplot -p -e "set terminal pngcairo;
set output './reports/${PLOTNAME}.png';
set title '${PLOTNAME}';
set xlabel 'Num of Threads';
set ylabel 'Spawn per Second';
set logscale y;
set format y '10^{%L}';
set xrange [1:];
set xtics 1;
unset key;
plot '<cat' with linespoints
"
fi
done
# Plotting all results in one figure
for (( ii=1; ii<=${NL}; ii++ ))
do
if [ $((ii%3)) -eq 2 ]
then
sed -n "${ii}p;$((ii+1))p" < ./reports/all_4_plot.txt
fi
done | awk ' {
for (i=1; i<=NF; i++) {
a[NR,i] = $i
}
}
NF>p { p = NF }
END {
for(j=1; j<=p; j++) {
str=a[1,j]
for(i=2; i<=NR; i++) {
str=str" "a[i,j];
}
print str
}
}' | awk ' {
printf "%d",$1;line=""
for (i=2;i<=NF;i+=2)
line=line (" " 1/$i)
print line
}' > tmp.data
for (( ii=1; ii<=${NL}; ii++ ))
do
if [ $((ii%3)) -eq 2 ]
then
sed -n "$((ii-1))p" < ./reports/all_4_plot.txt
fi
done > tmp.titles
echo "set terminal pngcairo;
set output './reports/all_plot.png';
set title 'forkbench';
set xlabel 'Num of Threads';
set ylabel 'Spawn per Second';
set logscale y;
set format y '10^{%L}';
set xrange [1:];
set xtics 1;
set key out vert;
set key reverse center right;" > tmp.plotcommand
PLOTNAME=`sed -n "1p" < tmp.titles`
echo "plot 'tmp.data' using 1:2 title '$PLOTNAME' with linespoints, \\" >> tmp.plotcommand
for (( ii=2; ii<${NL}/3; ii++ ))
do
PLOTNAME=`sed -n "${ii}p" < tmp.titles`
echo " 'tmp.data' using 1:$((ii+1)) title '$PLOTNAME' with linespoints, \\" >> tmp.plotcommand
done
PLOTNAME=`sed -n "$((NL/3))p" < tmp.titles`
echo " 'tmp.data' using 1:$((NL/3+1)) title '$PLOTNAME' with linespoints" >> tmp.plotcommand
gnuplot -p tmp.plotcommand
rm tmp.data tmp.plotcommand tmp.titles