OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 3 # Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
4 # | 4 # |
5 # Use of this source code is governed by a BSD-style license | 5 # Use of this source code is governed by a BSD-style license |
6 # that can be found in the LICENSE file in the root of the source | 6 # that can be found in the LICENSE file in the root of the source |
7 # tree. An additional intellectual property rights grant can be found | 7 # tree. An additional intellectual property rights grant can be found |
8 # in the file PATENTS. All contributing project authors may | 8 # in the file PATENTS. All contributing project authors may |
9 # be found in the AUTHORS file in the root of the source tree. | 9 # be found in the AUTHORS file in the root of the source tree. |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 # Plot histograms. | 28 # Plot histograms. |
29 function gen_gnuplot_bar_input { | 29 function gen_gnuplot_bar_input { |
30 x_start=1 | 30 x_start=1 |
31 x_end=3.75 | 31 x_end=3.75 |
32 bars=$(echo "$log" | grep "BAR") | 32 bars=$(echo "$log" | grep "BAR") |
33 | 33 |
34 labels=$(echo "$log" | grep "^LABEL") | 34 labels=$(echo "$log" | grep "^LABEL") |
35 figures=($(echo "$bars" | cut -f 2 | sort | uniq)) | 35 figures=($(echo "$bars" | cut -f 2 | sort | uniq)) |
36 | 36 |
37 echo "reset" | 37 echo "reset" # Clears previous settings. |
38 | 38 |
39 echo "set title font 'Verdana,22'" | 39 echo "set title font 'Verdana,22'" |
40 echo "set xtics font 'Verdana,24'" | 40 echo "set xtics font 'Verdana,24'" |
41 echo "set ytics font 'Verdana,14'" | 41 echo "set ytics font 'Verdana,14'" |
42 echo "set ylabel font 'Verdana,16'" | 42 echo "set ylabel font 'Verdana,16'" |
43 | 43 |
44 echo "set xrange[$x_start:$x_end]" | 44 echo "set xrange[$x_start:$x_end]" |
45 echo "set style fill solid 0.5" | 45 echo "set style fill solid 0.5" |
46 echo "set style fill solid border -1" | 46 echo "set style fill solid border -1" |
47 | 47 |
48 ydist=11 # Used to correctly offset the y label. | 48 declare -a ydist=(11.5 10.5 10.5) # Used to correctly offset the y label. |
| 49 i=0 |
49 for figure in "${figures[@]}" ; do | 50 for figure in "${figures[@]}" ; do |
50 | 51 |
51 echo "set terminal wxt $figure size 440,440 dashed" | 52 echo "set terminal wxt $figure size 440,440 dashed" |
52 echo "set ylabel offset $ydist, -3" | 53 echo "set ylabel offset ${ydist[$i]}, -3" |
53 ((ydist--)) | 54 (( i++ )) |
54 | 55 |
55 title=$(echo "$labels" | grep "^LABEL.$figure" | cut -f 3 | \ | 56 title=$(echo "$labels" | grep "^LABEL.$figure" | cut -f 3 | \ |
56 head -n 1 | sed 's/_/ /g') | 57 head -n 1 | sed 's/_/ /g') |
57 y_label=$(echo "$labels" | grep "^LABEL.$figure" | cut -f 4 | \ | 58 y_label=$(echo "$labels" | grep "^LABEL.$figure" | cut -f 4 | \ |
58 head -n 1 | sed 's/_/ /g') | 59 head -n 1 | sed 's/_/ /g') |
59 | 60 |
60 # RMCAT flows. | 61 # RMCAT flows. |
61 num_flows=$(echo "$labels" | grep "^LABEL.$figure" | cut -f 5 | \ | 62 num_flows=$(echo "$labels" | grep "^LABEL.$figure" | cut -f 5 | \ |
62 head -n 1) | 63 head -n 1) |
63 | 64 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 box_width=$(echo 1.0/$num_flows | bc -l) | 101 box_width=$(echo 1.0/$num_flows | bc -l) |
101 fi | 102 fi |
102 | 103 |
103 echo "set boxwidth $box_width" | 104 echo "set boxwidth $box_width" |
104 | 105 |
105 # Plots can be directly exported to image files. | 106 # Plots can be directly exported to image files. |
106 file_name=$(echo "$labels" | grep "^LABEL.$figure" | cut -f 5 | head -n 1) | 107 file_name=$(echo "$labels" | grep "^LABEL.$figure" | cut -f 5 | head -n 1) |
107 | 108 |
108 y_max=0 # Used to scale the plot properly. | 109 y_max=0 # Used to scale the plot properly. |
109 | 110 |
110 # Since only the optimal bitrate for the first flow is being ploted, | |
111 # consider only this one for scalling purposes. | |
112 data_sets=$(echo "$bars" | grep "LIMITERRORBAR.$figure" | cut -f 3 | \ | |
113 sed 's/_/\t/g' | cut -f 1 | sort | uniq) | |
114 | |
115 if (( ${#data_sets} > "0" )); then | |
116 for set in $data_sets ; do | |
117 y=$(echo "$bars" | grep "LIMITERRORBAR.$figure.$set" | cut -f 8 | \ | |
118 head -n 1) | |
119 if (( $(bc <<< "$y > $y_max") == 1 )); then | |
120 y_max=$y | |
121 fi | |
122 done | |
123 fi | |
124 | |
125 data_sets=$(echo "$bars" | grep "ERRORBAR.$figure" | cut -f 3 | sort | uniq) | |
126 if (( ${#data_sets} > "0" )); then | |
127 for set in $data_sets ; do | |
128 y=$(echo "$bars" | grep "ERRORBAR.$figure.$set" | cut -f 6 | head -n 1) | |
129 if (( $(bc <<< "$y > $y_max") == 1 )) ; then | |
130 y_max=$y | |
131 fi | |
132 done | |
133 fi | |
134 | |
135 data_sets=$(echo "$bars" | grep "BAR.$figure" | cut -f 3 | sort | uniq) | |
136 | |
137 for set in $data_sets ; do | |
138 y=$(echo "$bars" | grep "BAR.$figure.$set" | cut -f 4 | head -n 1) | |
139 if (( $(bc <<< "$y > $y_max") == 1 )) ; then | |
140 y_max=$y | |
141 fi | |
142 done | |
143 | |
144 y_max=$(echo $y_max*1.1 | bc) | |
145 | |
146 # Scale all latency plots with the same vertical scale. | 111 # Scale all latency plots with the same vertical scale. |
147 delay_figure=5 | 112 delay_figure=5 |
148 if (( $figure==$delay_figure )) ; then | 113 if (( $figure==$delay_figure )) ; then |
149 y_max=250 | 114 y_max=250 |
| 115 else # Take y_max = 1.1 * highest plot value. |
| 116 |
| 117 # Since only the optimal bitrate for the first flow is being ploted, |
| 118 # consider only this one for scalling purposes. |
| 119 data_sets=$(echo "$bars" | grep "LIMITERRORBAR.$figure" | cut -f 3 | \ |
| 120 sed 's/_/\t/g' | cut -f 1 | sort | uniq) |
| 121 |
| 122 if (( ${#data_sets[@]} > "0" )); then |
| 123 for set in $data_sets ; do |
| 124 y=$(echo "$bars" | grep "LIMITERRORBAR.$figure.$set" | cut -f 8 | \ |
| 125 head -n 1) |
| 126 if (( $(bc <<< "$y > $y_max") == 1 )); then |
| 127 y_max=$y |
| 128 fi |
| 129 done |
| 130 fi |
| 131 |
| 132 data_sets=$(echo "$bars" | grep "ERRORBAR.$figure" | cut -f 3 | \ |
| 133 sort | uniq) |
| 134 if (( ${#data_sets[@]} > "0" )); then |
| 135 for set in $data_sets ; do |
| 136 y=$(echo "$bars" | grep "ERRORBAR.$figure.$set" | cut -f 6 | \ |
| 137 head -n 1) |
| 138 if (( $(bc <<< "$y > $y_max") == 1 )) ; then |
| 139 y_max=$y |
| 140 fi |
| 141 done |
| 142 fi |
| 143 |
| 144 data_sets=$(echo "$bars" | grep "BAR.$figure" | cut -f 3 | sort | uniq) |
| 145 |
| 146 for set in $data_sets ; do |
| 147 y=$(echo "$bars" | grep "BAR.$figure.$set" | cut -f 4 | head -n 1) |
| 148 if (( $(bc <<< "$y > $y_max") == 1 )) ; then |
| 149 y_max=$y |
| 150 fi |
| 151 done |
| 152 |
| 153 y_max=$(echo $y_max*1.1 | bc) |
150 fi | 154 fi |
151 | 155 |
| 156 |
152 echo "set ylabel \"$y_label\"" | 157 echo "set ylabel \"$y_label\"" |
153 echo "set yrange[0:$y_max]" | 158 echo "set yrange[0:$y_max]" |
154 | 159 |
155 echo "set multiplot" | 160 echo "set multiplot" |
156 | 161 |
157 # Plot bars. | 162 # Plot bars. |
158 data_sets=$(echo "$bars" | grep "BAR.$figure" | cut -f 3 | sort | uniq) | 163 data_sets=$(echo "$bars" | grep "BAR.$figure" | cut -f 3 | sort | uniq) |
159 | 164 |
160 echo "set xtics $x_labels" | 165 echo "set xtics $x_labels" |
161 echo "plot '-' using 1:4:2 with boxes lc variable notitle" | 166 echo "plot '-' using 1:4:2 with boxes lc variable notitle" |
(...skipping 24 matching lines...) Expand all Loading... |
186 (( $(bc <<< "(100*$x_bar)%100 < 50") == 1 )) | 191 (( $(bc <<< "(100*$x_bar)%100 < 50") == 1 )) |
187 then | 192 then |
188 color=18 # Gray. | 193 color=18 # Gray. |
189 fi | 194 fi |
190 done | 195 done |
191 echo "e" | 196 echo "e" |
192 | 197 |
193 # Plot Baseline bars, e.g. one-way path delay on latency plots. | 198 # Plot Baseline bars, e.g. one-way path delay on latency plots. |
194 data_sets=$(echo "$log" | grep "BASELINE.$figure" | cut -f 3 | sort | uniq) | 199 data_sets=$(echo "$log" | grep "BASELINE.$figure" | cut -f 3 | sort | uniq) |
195 | 200 |
196 echo "set xtics $x_labels" | 201 if (( ${#data_sets} > "0" )); then |
197 echo "plot '-' using 1:4:2 with boxes lc variable notitle" | 202 echo "set xtics $x_labels" |
| 203 echo "plot '-' using 1:4:2 with boxes lc variable notitle" |
198 | 204 |
199 echo | 205 echo |
200 | 206 |
201 color=18 # Gray. | 207 color=18 # Gray. |
202 x_bar=$(echo $x_start + 0.5 + 0.5*$box_width | bc) | 208 x_bar=$(echo $x_start + 0.5 + 0.5*$box_width | bc) |
203 for set in $data_sets ; do | 209 for set in $data_sets ; do |
204 echo -n "$x_bar $color " | 210 echo -n "$x_bar $color " |
205 echo "$log" | grep "BASELINE.$figure.$set" | cut -f 3,4 | 211 echo "$log" | grep "BASELINE.$figure.$set" | cut -f 3,4 |
206 | 212 |
207 # Add extra space if TCP flows are being plotted. | 213 # Add extra space if TCP flows are being plotted. |
208 if $tcp_flow && \ | 214 if $tcp_flow && \ |
209 (( $(bc <<< "$x_bar < $x_start + 1.5 - 0.5*$tcp_space") == 1 )) && \ | 215 (( $(bc <<< "$x_bar < $x_start + 1.5 - 0.5*$tcp_space") == 1 )) && \ |
210 (( $(bc <<< "$x_bar + $box_width > $x_start + 1.5 + 0.5*$tcp_space") \ | 216 (( $(bc <<< "$x_bar + $box_width > $x_start + 1.5 \ |
211 == 1 )); then | 217 + 0.5*$tcp_space") == 1 )); then |
212 x_bar=$(echo $x_bar + $tcp_space | bc) | 218 x_bar=$(echo $x_bar + $tcp_space | bc) |
213 fi | 219 fi |
214 | 220 |
215 x_bar=$(echo $x_bar + $box_width | bc) | 221 x_bar=$(echo $x_bar + $box_width | bc) |
216 | 222 |
217 done | 223 done |
218 echo "e" | 224 echo "e" |
| 225 fi |
219 | 226 |
220 # Plot vertical error lines, e.g. y +- sigma. | 227 # Plot vertical error lines, e.g. y +- sigma. |
221 data_sets=$(echo "$bars" | grep "ERRORBAR.$figure" | cut -f 3 | sort | uniq) | 228 data_sets=$(echo "$bars" | grep "ERRORBAR.$figure" | cut -f 3 | sort | uniq) |
222 | 229 |
223 if (( ${#data_sets} > "0" )); then | 230 if (( ${#data_sets} > "0" )); then |
224 | 231 |
225 echo "set key left" | 232 echo "set key left" |
226 error_title=$(echo "$bars" | grep "ERRORBAR.$figure" | cut -f 7 | \ | 233 error_title=$(echo "$bars" | grep "ERRORBAR.$figure" | cut -f 7 | \ |
227 head -n 1 | sed 's/_/ /g') | 234 head -n 1 | sed 's/_/ /g') |
228 | 235 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 echo "set xtics $x_labels" | 275 echo "set xtics $x_labels" |
269 echo "plot $y_max lt 7 lw 1 linecolor rgb 'black' \ | 276 echo "plot $y_max lt 7 lw 1 linecolor rgb 'black' \ |
270 title '$retouched_title'" | 277 title '$retouched_title'" |
271 done | 278 done |
272 | 279 |
273 fi | 280 fi |
274 | 281 |
275 echo "unset multiplot" | 282 echo "unset multiplot" |
276 done | 283 done |
277 } | 284 } |
| 285 |
278 gen_gnuplot_bar_input | gnuplot -persist | 286 gen_gnuplot_bar_input | gnuplot -persist |
OLD | NEW |