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. | 10 # This script is used to plot simulation dynamics. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 return self._subplot | 42 return self._subplot |
43 | 43 |
44 def getYMax(self): | 44 def getYMax(self): |
45 return self._y_max | 45 return self._y_max |
46 | 46 |
47 def getNumberOfFlows(self): | 47 def getNumberOfFlows(self): |
48 return len(self.samples) | 48 return len(self.samples) |
49 | 49 |
50 | 50 |
51 def addSample(self, line): | 51 def addSample(self, line): |
52 groups = re.search(r'_(((\d)+((,(\d)+)*))_(\D+))#\d@(\S+)', line) | 52 groups = re.search(r'_(((\d)+((,(\d)+)*))_(\D+))#\d:(\d)@(\S+)', line) |
53 | 53 |
54 # Each variable will be plotted in a separated box. | 54 # Each variable will be plotted in a separated box. |
55 var_name = groups.group(1) | 55 var_name = groups.group(1) |
56 alg_name = groups.group(8) | 56 alg_name = groups.group(9) |
57 | 57 |
58 alg_name = alg_name.replace('_', ' ') | 58 alg_name = alg_name.replace('_', ' ') |
59 | 59 |
60 if alg_name not in self.samples.keys(): | 60 if alg_name not in self.samples.keys(): |
61 self.samples[alg_name] = {} | 61 self.samples[alg_name] = {} |
62 | 62 |
63 if var_name not in self.samples[alg_name].keys(): | 63 if var_name not in self.samples[alg_name].keys(): |
64 self.samples[alg_name][var_name] = [] | 64 self.samples[alg_name][var_name] = [] |
65 | 65 |
66 sample = re.search(r'(\d+\.\d+)\t([-]?\d+\.\d+)', line) | 66 sample = re.search(r'(\d+\.\d+)\t([-]?\d+\.\d+)', line) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 if show_legend: | 120 if show_legend: |
121 plt.legend(loc='upper center', bbox_to_anchor=(0.5, 1.40), | 121 plt.legend(loc='upper center', bbox_to_anchor=(0.5, 1.40), |
122 shadow=True, fontsize='large', ncol=len(v.samples)) | 122 shadow=True, fontsize='large', ncol=len(v.samples)) |
123 | 123 |
124 def main(): | 124 def main(): |
125 variables = [ | 125 variables = [ |
126 ('Throughput_kbps', "Time (s)", "Throughput (kbps)", 1, 4000), | 126 ('Throughput_kbps', "Time (s)", "Throughput (kbps)", 1, 4000), |
127 ('Delay_ms', "Time (s)", "One-way Delay (ms)", 2, 500), | 127 ('Delay_ms', "Time (s)", "One-way Delay (ms)", 2, 500), |
128 ('Packet_Loss', "Time (s)", "Packet Loss Ratio", 3, 1.0), | 128 ('Packet_Loss', "Time (s)", "Packet Loss Ratio", 3, 1.0), |
129 # ('Sending_Estimate_kbps', "Time (s)", "Sending Estimate (kbps)", | |
130 # 4, 4000), | |
131 ] | 129 ] |
132 | 130 |
133 var = [] | 131 var = [] |
134 | 132 |
135 # Create objects. | 133 # Create objects. |
136 for variable in variables: | 134 for variable in variables: |
137 var.append(Variable(variable)) | 135 var.append(Variable(variable)) |
138 | 136 |
139 # Add samples to the objects. | 137 # Add samples to the objects. |
140 for line in sys.stdin: | 138 for line in sys.stdin: |
(...skipping 16 matching lines...) Expand all Loading... |
157 ax = fig.add_subplot(n, 1, v.getSubplot()) | 155 ax = fig.add_subplot(n, 1, v.getSubplot()) |
158 plotVar(v, ax, i == 0, i == n - 1) | 156 plotVar(v, ax, i == 0, i == n - 1) |
159 i += 1 | 157 i += 1 |
160 | 158 |
161 if save_figure: | 159 if save_figure: |
162 fig.savefig(test_name + ".png") | 160 fig.savefig(test_name + ".png") |
163 plt.show() | 161 plt.show() |
164 | 162 |
165 if __name__ == '__main__': | 163 if __name__ == '__main__': |
166 main() | 164 main() |
OLD | NEW |