OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 # Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 # | 3 # |
4 # Use of this source code is governed by a BSD-style license | 4 # Use of this source code is governed by a BSD-style license |
5 # that can be found in the LICENSE file in the root of the source | 5 # that can be found in the LICENSE file in the root of the source |
6 # tree. An additional intellectual property rights grant can be found | 6 # tree. An additional intellectual property rights grant can be found |
7 # in the file PATENTS. All contributing project authors may | 7 # in the file PATENTS. All contributing project authors may |
8 # be found in the AUTHORS file in the root of the source tree. | 8 # be found in the AUTHORS file in the root of the source tree. |
9 | 9 |
10 # This script is used to plot simulation dynamics. The expected format is | 10 # This script is used to plot simulation dynamics. The expected format is |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 detector_state = Figure("DetectorState") | 139 detector_state = Figure("DetectorState") |
140 detector_state.addSubplot(['offset_ms'], "Time (s)", "Offset") | 140 detector_state.addSubplot(['offset_ms'], "Time (s)", "Offset") |
141 detector_state.addSubplot(['gamma_ms'], "Time (s)", "Gamma") | 141 detector_state.addSubplot(['gamma_ms'], "Time (s)", "Gamma") |
142 | 142 |
143 trendline_state = Figure("TrendlineState") | 143 trendline_state = Figure("TrendlineState") |
144 trendline_state.addSubplot(["accumulated_delay_ms", "smoothed_delay_ms"], | 144 trendline_state.addSubplot(["accumulated_delay_ms", "smoothed_delay_ms"], |
145 "Time (s)", "Delay (ms)") | 145 "Time (s)", "Delay (ms)") |
146 trendline_state.addSubplot(["trendline_slope"], "Time (s)", "Slope") | 146 trendline_state.addSubplot(["trendline_slope"], "Time (s)", "Slope") |
147 | 147 |
| 148 target_bitrate = Figure("TargetBitrate") |
| 149 target_bitrate.addSubplot(['target_bitrate_bps'], "Time (s)", "Bitrate (bps)") |
| 150 |
148 # Select which figures to plot here. | 151 # Select which figures to plot here. |
149 figures = [receiver, detector_state, trendline_state] | 152 figures = [receiver, detector_state, trendline_state, target_bitrate] |
150 | 153 |
151 # Add samples to the figures. | 154 # Add samples to the figures. |
152 for line in sys.stdin: | 155 for line in sys.stdin: |
153 if line.startswith("[ RUN ]"): | 156 if line.startswith("[ RUN ]"): |
154 test_name = re.search(r'\.(\w+)', line).group(1) | 157 test_name = re.search(r'\.(\w+)', line).group(1) |
155 if line.startswith("PLOT"): | 158 if line.startswith("PLOT"): |
156 try: | 159 try: |
157 (var_name, ssrc, alg_name, time, value) = parse_plot_line(line) | 160 (var_name, ssrc, alg_name, time, value) = parse_plot_line(line) |
158 for f in figures: | 161 for f in figures: |
159 # The sample will be ignored bv the figures that don't need it. | 162 # The sample will be ignored bv the figures that don't need it. |
160 f.addSample(var_name, ssrc, alg_name, time, value) | 163 f.addSample(var_name, ssrc, alg_name, time, value) |
161 except ParsePlotLineException as e: | 164 except ParsePlotLineException as e: |
162 print e.reason | 165 print e.reason |
163 print e.line | 166 print e.line |
164 | 167 |
165 # Plot figures. | 168 # Plot figures. |
166 for f in figures: | 169 for f in figures: |
167 fig = plt.figure(f.name) | 170 fig = plt.figure(f.name) |
168 f.plotFigure(fig) | 171 f.plotFigure(fig) |
169 if save_figure: | 172 if save_figure: |
170 fig.savefig(test_name + f.name + ".png") | 173 fig.savefig(test_name + f.name + ".png") |
171 plt.show() | 174 plt.show() |
172 | 175 |
173 if __name__ == '__main__': | 176 if __name__ == '__main__': |
174 main() | 177 main() |
OLD | NEW |