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

Side by Side Diff: ct/py/csv_comparer.py

Issue 1411423003: [CT] Add ability to run unlanded benchmarks on Chromium Perf (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Add documentation link Created 5 years, 2 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Python utility to compare two CSV files and output HTML results.""" 6 """Python utility to compare two CSV files and output HTML results."""
7 7
8 8
9 import csv 9 import csv
10 import datetime 10 import datetime
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 def __init__(self, value1, value2, perc_diff): 56 def __init__(self, value1, value2, perc_diff):
57 self.value1 = value1 57 self.value1 = value1
58 self.value2 = value2 58 self.value2 = value2
59 self.perc_diff = perc_diff 59 self.perc_diff = perc_diff
60 60
61 61
62 class CsvComparer(object): 62 class CsvComparer(object):
63 """Class that compares two telemetry CSV files and outputs HTML results.""" 63 """Class that compares two telemetry CSV files and outputs HTML results."""
64 64
65 def __init__(self, csv_file1, csv_file2, output_html_dir, requester_email, 65 def __init__(self, csv_file1, csv_file2, output_html_dir, requester_email,
66 chromium_patch_link, skia_patch_link, 66 chromium_patch_link, skia_patch_link, benchmark_patch_link,
67 variance_threshold, absolute_url, min_pages_in_each_field, 67 variance_threshold, absolute_url, min_pages_in_each_field,
68 discard_outliers, raw_csv_nopatch, raw_csv_withpatch, 68 discard_outliers, raw_csv_nopatch, raw_csv_withpatch,
69 num_repeated, target_platform, crashed_instances, 69 num_repeated, target_platform, crashed_instances,
70 missing_devices, browser_args_nopatch, browser_args_withpatch, 70 missing_devices, browser_args_nopatch, browser_args_withpatch,
71 pageset_type, chromium_hash, skia_hash, missing_output_slaves, 71 pageset_type, chromium_hash, skia_hash, missing_output_slaves,
72 logs_link_prefix, description): 72 logs_link_prefix, description):
73 """Constructs a CsvComparer instance.""" 73 """Constructs a CsvComparer instance."""
74 self._csv_file1 = csv_file1 74 self._csv_file1 = csv_file1
75 self._csv_file2 = csv_file2 75 self._csv_file2 = csv_file2
76 self._output_html_dir = output_html_dir 76 self._output_html_dir = output_html_dir
77 self._requester_email = requester_email 77 self._requester_email = requester_email
78 self._chromium_patch_link = chromium_patch_link 78 self._chromium_patch_link = chromium_patch_link
79 self._skia_patch_link = skia_patch_link 79 self._skia_patch_link = skia_patch_link
80 self._benchmark_patch_link = benchmark_patch_link
80 self._variance_threshold = float(variance_threshold) 81 self._variance_threshold = float(variance_threshold)
81 self._absolute_url = absolute_url 82 self._absolute_url = absolute_url
82 self._min_pages_in_each_field = min_pages_in_each_field 83 self._min_pages_in_each_field = min_pages_in_each_field
83 self._discard_outliers = float(discard_outliers) 84 self._discard_outliers = float(discard_outliers)
84 self._raw_csv_nopatch = raw_csv_nopatch 85 self._raw_csv_nopatch = raw_csv_nopatch
85 self._raw_csv_withpatch = raw_csv_withpatch 86 self._raw_csv_withpatch = raw_csv_withpatch
86 self._num_repeated = num_repeated 87 self._num_repeated = num_repeated
87 self._target_platform = target_platform 88 self._target_platform = target_platform
88 self._crashed_instances = crashed_instances 89 self._crashed_instances = crashed_instances
89 self._missing_devices = missing_devices 90 self._missing_devices = missing_devices
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 reverse=True) 290 reverse=True)
290 missing_output_slaves_list = [] 291 missing_output_slaves_list = []
291 if self._missing_output_slaves: 292 if self._missing_output_slaves:
292 missing_output_slaves_list = self._missing_output_slaves.split(' ') 293 missing_output_slaves_list = self._missing_output_slaves.split(' ')
293 rendered = loader.render_to_string( 294 rendered = loader.render_to_string(
294 'csv_totals.html', 295 'csv_totals.html',
295 {'sorted_fieldnames_totals_items': sorted_fieldnames_totals_items, 296 {'sorted_fieldnames_totals_items': sorted_fieldnames_totals_items,
296 'requester_email': self._requester_email, 297 'requester_email': self._requester_email,
297 'chromium_patch_link': self._chromium_patch_link, 298 'chromium_patch_link': self._chromium_patch_link,
298 'skia_patch_link': self._skia_patch_link, 299 'skia_patch_link': self._skia_patch_link,
300 'benchmark_patch_link': self._benchmark_patch_link,
299 'raw_csv_nopatch': self._raw_csv_nopatch, 301 'raw_csv_nopatch': self._raw_csv_nopatch,
300 'raw_csv_withpatch': self._raw_csv_withpatch, 302 'raw_csv_withpatch': self._raw_csv_withpatch,
301 'threshold': self._variance_threshold, 303 'threshold': self._variance_threshold,
302 'discard_outliers': self._discard_outliers, 304 'discard_outliers': self._discard_outliers,
303 'min_webpages': self._min_pages_in_each_field, 305 'min_webpages': self._min_pages_in_each_field,
304 'num_repeated': self._num_repeated, 306 'num_repeated': self._num_repeated,
305 'target_platform': self._target_platform, 307 'target_platform': self._target_platform,
306 'crashed_instances': self._crashed_instances, 308 'crashed_instances': self._crashed_instances,
307 'missing_devices': self._missing_devices, 309 'missing_devices': self._missing_devices,
308 'browser_args_nopatch': self._browser_args_nopatch, 310 'browser_args_nopatch': self._browser_args_nopatch,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 option_parser.add_option( 355 option_parser.add_option(
354 '', '--requester_email', 356 '', '--requester_email',
355 help='Email address of the user who kicked off the run.') 357 help='Email address of the user who kicked off the run.')
356 option_parser.add_option( 358 option_parser.add_option(
357 '', '--chromium_patch_link', 359 '', '--chromium_patch_link',
358 help='Link to the Chromium patch used for this run.') 360 help='Link to the Chromium patch used for this run.')
359 option_parser.add_option( 361 option_parser.add_option(
360 '', '--skia_patch_link', 362 '', '--skia_patch_link',
361 help='Link to the Skia patch used for this run.') 363 help='Link to the Skia patch used for this run.')
362 option_parser.add_option( 364 option_parser.add_option(
365 '', '--benchmark_patch_link',
366 help='Link to the Telemetry patch used for this run.')
367 option_parser.add_option(
363 '', '--variance_threshold', 368 '', '--variance_threshold',
364 help='The allowable variance in percentage between total values for each ' 369 help='The allowable variance in percentage between total values for each '
365 'field for the two CSVs.') 370 'field for the two CSVs.')
366 option_parser.add_option( 371 option_parser.add_option(
367 '', '--absolute_url', 372 '', '--absolute_url',
368 help='Servers like Google Storage require an absolute url for links ' 373 help='Servers like Google Storage require an absolute url for links '
369 'within the HTML output files.', 374 'within the HTML output files.',
370 default='') 375 default='')
371 option_parser.add_option( 376 option_parser.add_option(
372 '', '--min_pages_in_each_field', 377 '', '--min_pages_in_each_field',
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 option_parser.add_option( 425 option_parser.add_option(
421 '', '--logs_link_prefix', 426 '', '--logs_link_prefix',
422 help='Prefix link to the logs of the slaves.') 427 help='Prefix link to the logs of the slaves.')
423 option_parser.add_option( 428 option_parser.add_option(
424 '', '--description', 429 '', '--description',
425 help='The description of the run as entered by the requester.') 430 help='The description of the run as entered by the requester.')
426 431
427 options, unused_args = option_parser.parse_args() 432 options, unused_args = option_parser.parse_args()
428 if not (options.csv_file1 and options.csv_file2 and options.output_html_dir 433 if not (options.csv_file1 and options.csv_file2 and options.output_html_dir
429 and options.variance_threshold and options.requester_email 434 and options.variance_threshold and options.requester_email
430 and options.chromium_patch_link 435 and options.chromium_patch_link and options.benchmark_patch_link
431 and options.skia_patch_link and options.raw_csv_nopatch 436 and options.skia_patch_link and options.raw_csv_nopatch
432 and options.raw_csv_withpatch and options.num_repeated 437 and options.raw_csv_withpatch and options.num_repeated
433 and options.target_platform and options.pageset_type 438 and options.target_platform and options.pageset_type
434 and options.chromium_hash and options.skia_hash 439 and options.chromium_hash and options.skia_hash
435 and options.description): 440 and options.description):
436 option_parser.error('Must specify csv_file1, csv_file2, output_html_dir, ' 441 option_parser.error('Must specify csv_file1, csv_file2, output_html_dir, '
437 'variance_threshold, requester_email, ' 442 'variance_threshold, requester_email, '
438 'chromium_patch_link, ' 443 'chromium_patch_link, benchmark_patch_link, '
439 'skia_patch_link, raw_csv_nopatch, description, ' 444 'skia_patch_link, raw_csv_nopatch, description, '
440 'raw_csv_withpatch, num_repeated, pageset_type, ' 445 'raw_csv_withpatch, num_repeated, pageset_type, '
441 'chromium_hash, skia_hash and target_platform') 446 'chromium_hash, skia_hash and target_platform')
442 447
443 sys.exit(CsvComparer( 448 sys.exit(CsvComparer(
444 options.csv_file1, options.csv_file2, options.output_html_dir, 449 options.csv_file1, options.csv_file2, options.output_html_dir,
445 options.requester_email, options.chromium_patch_link, 450 options.requester_email, options.chromium_patch_link,
446 options.skia_patch_link, 451 options.skia_patch_link, options.benchmark_patch_link,
447 options.variance_threshold, options.absolute_url, 452 options.variance_threshold, options.absolute_url,
448 options.min_pages_in_each_field, options.discard_outliers, 453 options.min_pages_in_each_field, options.discard_outliers,
449 options.raw_csv_nopatch, options.raw_csv_withpatch, 454 options.raw_csv_nopatch, options.raw_csv_withpatch,
450 options.num_repeated, options.target_platform, 455 options.num_repeated, options.target_platform,
451 options.crashed_instances, options.missing_devices, 456 options.crashed_instances, options.missing_devices,
452 options.browser_args_nopatch, options.browser_args_withpatch, 457 options.browser_args_nopatch, options.browser_args_withpatch,
453 options.pageset_type, options.chromium_hash, options.skia_hash, 458 options.pageset_type, options.chromium_hash, options.skia_hash,
454 options.missing_output_slaves, options.logs_link_prefix, 459 options.missing_output_slaves, options.logs_link_prefix,
455 options.description).Compare()) 460 options.description).Compare())
456 461
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698