Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/test/plot_dynamics.py

Issue 1270543002: Supporting Pause/Resume, Sending Estimate logging. Corrected plot colors (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Removed PacketSender member from MetricRecorder Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/test/packet_sender.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 s = (sample.group(1),sample.group(2)) 67 s = (sample.group(1),sample.group(2))
68 self._samples[alg_name][var_name].append(s) 68 self._samples[alg_name][var_name].append(s)
69 69
70 def plotVar(v, ax, show_legend, show_x_label): 70 def plotVar(v, ax, show_legend, show_x_label):
71 if show_x_label: 71 if show_x_label:
72 ax.set_xlabel(v.getXLabel(), fontsize='large') 72 ax.set_xlabel(v.getXLabel(), fontsize='large')
73 ax.set_ylabel(v.getYLabel(), fontsize='large') 73 ax.set_ylabel(v.getYLabel(), fontsize='large')
74 74
75 for alg in v._samples.keys(): 75 for alg in v._samples.keys():
76 i = 1 76
77 for series in v._samples[alg].keys(): 77 for series in v._samples[alg].keys():
78
78 x = [sample[0] for sample in v._samples[alg][series]] 79 x = [sample[0] for sample in v._samples[alg][series]]
79 y = [sample[1] for sample in v._samples[alg][series]] 80 y = [sample[1] for sample in v._samples[alg][series]]
80 x = numpy.array(x) 81 x = numpy.array(x)
81 y = numpy.array(y) 82 y = numpy.array(y)
83
82 line = plt.plot(x, y, label=alg, linewidth=4.0) 84 line = plt.plot(x, y, label=alg, linewidth=4.0)
83 colormap = {'Available1':'#AAAAAA',
84 'Available2':'#AAAAAA',
85 'GCC1':'#80D000',
86 'GCC2':'#008000',
87 'GCC3':'#00F000',
88 'GCC4':'#00B000',
89 'GCC5':'#70B020',
90 'NADA1':'#0000AA',
91 'NADA2':'#A0A0FF',
92 'NADA3':'#0000FF',
93 'NADA4':'#C0A0FF',
94 'NADA5':'#9060B0',}
95 85
96 key = alg + str(i) 86 colormap = {'Available0':'#AAAAAA',
87 'Available1':'#AAAAAA',
88 'GCC0':'#80D000',
89 'GCC1':'#008000',
90 'GCC2':'#00F000',
91 'GCC3':'#00B000',
92 'GCC4':'#70B020',
93 'NADA0':'#0000AA',
94 'NADA1':'#A0A0FF',
95 'NADA2':'#0000FF',
96 'NADA3':'#C0A0FF',
97 'NADA4':'#9060B0',}
98
99 flow_id = re.search(r'(\d+(,\d+)*)', series) # One or multiple ids.
100 key = alg + flow_id.group(1)
101
97 if key in colormap: 102 if key in colormap:
98 plt.setp(line, color=colormap[key]) 103 plt.setp(line, color=colormap[key])
99 elif alg == 'TCP': 104 elif alg == 'TCP':
100 plt.setp(line, color='#AAAAAA') 105 plt.setp(line, color='#AAAAAA')
101 else: 106 else:
102 plt.setp(line, color='#654321') 107 plt.setp(line, color='#654321')
103 108
104 if alg.startswith('Available'): 109 if alg.startswith('Available'):
105 plt.setp(line, linestyle='--') 110 plt.setp(line, linestyle='--')
106 plt.grid(True) 111 plt.grid(True)
107 112
108 x1, x2, y1, y2 = plt.axis() 113 x1, x2, y1, y2 = plt.axis()
109 if v.getYMax() >= 0: 114 if v.getYMax() >= 0:
110 y2 = v.getYMax() 115 y2 = v.getYMax()
111 plt.axis((0, x2, 0, y2)) 116 plt.axis((0, x2, 0, y2))
112 i += 1
113 117
114 if show_legend: 118 if show_legend:
115 legend = plt.legend(loc='upper center', bbox_to_anchor=(0.5, 1.40), 119 legend = plt.legend(loc='upper center', bbox_to_anchor=(0.5, 1.40),
116 shadow=True, fontsize='medium', ncol=len(v._samples)) 120 shadow=True, fontsize='large', ncol=len(v._samples))
117 121
118 if __name__ == '__main__': 122 if __name__ == '__main__':
119 123
120 variables = [ 124 variables = [
121 ('Throughput_kbps', "Time (s)", "Throughput (kbps)", 1, 4000), 125 ('Throughput_kbps', "Time (s)", "Throughput (kbps)", 1, 4000),
122 ('Delay_ms', "Time (s)", "One-way Delay (ms)", 2, 500), 126 ('Delay_ms', "Time (s)", "One-way Delay (ms)", 2, 500),
123 ('Packet_Loss', "Time (s)", "Packet Loss Ratio", 3, 1.0), 127 ('Packet_Loss', "Time (s)", "Packet Loss Ratio", 3, 1.0),
128 # ('Sending_Estimate_kbps', "Time (s)", "Sending Estimate (kbps)",
129 # 4, 4000),
124 ] 130 ]
125 131
126 var = [] 132 var = []
127 133
128 # Create objects. 134 # Create objects.
129 for variable in variables: 135 for variable in variables:
130 var.append(Variable(variable)) 136 var.append(Variable(variable))
131 137
132 # Add samples to the objects. 138 # Add samples to the objects.
133 for line in sys.stdin: 139 for line in sys.stdin:
134 if line.startswith("[ RUN ]"): 140 if line.startswith("[ RUN ]"):
135 test_name = re.search('\.(\w+)', line).group(1) 141 test_name = re.search('\.(\w+)', line).group(1)
136 if line.startswith("PLOT"): 142 if line.startswith("PLOT"):
137 for v in var: 143 for v in var:
138 if v.getID() in line: 144 if v.getID() in line:
139 v.addSample(line) 145 v.addSample(line)
140 146
141 matplotlib.rcParams.update({'font.size': 20}) 147 matplotlib.rcParams.update({'font.size': 48/len(variables)})
142 148
143 # Plot variables. 149 # Plot variables.
144 fig = plt.figure() 150 fig = plt.figure()
145 151
146 # Offest and threshold on the same plot. 152 # Offest and threshold on the same plot.
147 n = var[-1].getSubplot() 153 n = var[-1].getSubplot()
148 i = 0 154 i = 0
149 for v in var: 155 for v in var:
150 ax = fig.add_subplot(n, 1, v.getSubplot()) 156 ax = fig.add_subplot(n, 1, v.getSubplot())
151 plotVar(v, ax, i == 0, i == n - 1) 157 plotVar(v, ax, i == 0, i == n - 1)
152 i += 1 158 i += 1
153 159
154 #fig.savefig(test_name+".jpg") 160 #fig.savefig(test_name+".jpg")
155 plt.show() 161 plt.show()
156 162
OLDNEW
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/test/packet_sender.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698