186 benchmark_results_data = {}
187
188 for benchmark_result in benchmark_json:
189
190 if 'aggregate_name' in benchmark_result:
191 continue
192
193 benchmark_variant = benchmark_result['name'].split('/')
194
195 benchmark_variant.remove('real_time')
196
197 splits =
len(benchmark_variant)
198
199 benchmark_name = benchmark_variant[0]
200
201 benchmark_seeded_value = benchmark_variant[splits - 1]
202
203 benchmark_backend = benchmark_variant[splits - 2]
204
205 benchmark_real_time = benchmark_result['real_time']
206 benchmark_unit = benchmark_result['time_unit']
207
208 benchmark_family_index = benchmark_result['family_index']
209
210 benchmark_family_label = ''
211 if splits > 3:
212 for i in range(1, splits - 2):
213 benchmark_family_label += benchmark_variant[i] + ', '
214
216
217 if benchmark_family_attributes == '':
218 benchmark_family_label = benchmark_family_label[:-2]
219 else:
220 benchmark_family_label = benchmark_family_label + benchmark_family_attributes
221
222 if 'DrawCallCount' in benchmark_result:
223 benchmark_draw_call_count = benchmark_result['DrawCallCount']
224 else:
225 benchmark_draw_call_count = -1
226
227 optional_keys = ['DrawCallCount_Varies', 'VerbCount', 'PointCount', 'VertexCount', 'GlyphCount']
228
229 if benchmark_name not in benchmark_results_data:
230 benchmark_results_data[benchmark_name] = BenchmarkResult(
231 benchmark_name, benchmark_backend, benchmark_unit, benchmark_draw_call_count
232 )
233
234 for key in optional_keys:
235 if key in benchmark_result:
236 benchmark_results_data[benchmark_name].add_optional_value(
237 key, benchmark_seeded_value, benchmark_result[key]
238 )
239
240 benchmark_results_data[benchmark_name].add_data_point(
241 benchmark_family_index, benchmark_seeded_value, benchmark_real_time
242 )
243 benchmark_results_data[benchmark_name].set_family_label(
244 benchmark_family_index, benchmark_family_label
245 )
246
247 pdf = pdfp(output_pdf)
248
249 csv_file = open(output_csv, 'w')
250 csv_writer = csv.writer(csv_file)
251
252 for benchmark in benchmark_results_data:
253 figures = benchmark_results_data[benchmark].
plot()
254 for fig in figures:
255 pdf.savefig(fig)
256 benchmark_results_data[benchmark].write_csv(csv_writer)
257 pdf.close()
258
259
static void plot(SkCanvas *canvas, const char *fn, float xMin, float xMax, float yMin, float yMax, const char *label=nullptr, bool requireES3=false)