OLD | NEW |
| (Empty) |
1 #!/bin/bash | |
2 | |
3 # Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | |
4 # | |
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 | |
7 # tree. An additional intellectual property rights grant can be found | |
8 # in the file PATENTS. All contributing project authors may | |
9 # be found in the AUTHORS file in the root of the source tree. | |
10 | |
11 # To set up in e.g. Eclipse, run a separate shell and pipe the output from the | |
12 # test into this script. | |
13 # | |
14 # In Eclipse, that amounts to creating a Run Configuration which starts | |
15 # "/bin/bash" with the arguments "-c [trunk_path]/out/Debug/modules_unittests | |
16 # --gtest_filter=*BweTest* | [trunk_path]/webrtc/modules/ | |
17 # remote_bitrate_estimator/bwe_plot. | |
18 | |
19 # bwe_plot.sh supports multiple figures (windows), the figure is specified as an | |
20 # identifier at the first argument after the PLOT command. Each figure has a | |
21 # single y axis and a dual y axis mode. If any line specifies an axis by ending | |
22 # with "#<axis number (1 or 2)>" two y axis will be used, the first will be | |
23 # assumed to represent bitrate (in kbps) and the second will be assumed to | |
24 # represent time deltas (in ms). | |
25 | |
26 log=$(</dev/stdin) | |
27 | |
28 function gen_gnuplot_input { | |
29 colors=(a7001f 0a60c2 b2582b 21a66c d6604d 4393c3 f4a582 92c5de edcbb7 b1c5d0) | |
30 plots=$(echo "$log" | grep "^PLOT") | |
31 figures=($(echo "$plots" | cut -f 2 | sort | uniq)) | |
32 | |
33 for figure in "${figures[@]}" ; do | |
34 data_sets=$(echo "$plots" | grep "^PLOT.$figure" | cut -f 3 | sort | uniq) | |
35 linetypes=($(echo "$data_sets" | grep "#" | cut -d '#' -f 2 | \ | |
36 cut -d ' ' -f 1)) | |
37 echo -n "reset; " | |
38 echo -n "set terminal wxt $figure size 1440,900 font \"Arial,9\"; " | |
39 echo -n "set xlabel \"Seconds\"; " | |
40 if (( "${#linetypes[@]}" > "0" )); then | |
41 echo -n "set ylabel 'bitrate (kbps)';" | |
42 echo -n "set ytics nomirror;" | |
43 echo -n "set y2label 'time delta (ms)';" | |
44 echo -n "set y2tics nomirror;" | |
45 fi | |
46 echo -n "plot " | |
47 i=0 | |
48 for set in $data_sets ; do | |
49 (( i++ )) && echo -n "," | |
50 echo -n "'-' with " | |
51 echo -n "linespoints " | |
52 echo -n "ps 0.5 " | |
53 echo -n "lc rgbcolor \"#${colors[$(($i % 10))]}\" " | |
54 if (( "${#linetypes[@]}" > "0" )); then | |
55 if (( "$i" <= "${#linetypes[@]}" )); then | |
56 echo -n "axes x1y${linetypes[$i - 1]} " | |
57 else | |
58 # If no line type is specified, but line types are used, we will | |
59 # default to the bitrate axis. | |
60 echo -n "axes x1y1 " | |
61 fi | |
62 fi | |
63 echo -n "title \"$set\" " | |
64 done | |
65 echo | |
66 for set in $data_sets ; do | |
67 echo "$log" | grep "^PLOT.$figure.$set" | cut -f 4,5 | |
68 echo "e" | |
69 done | |
70 done | |
71 } | |
72 | |
73 gen_gnuplot_input | gnuplot -persist | |
OLD | NEW |