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

Side by Side Diff: telemetry/telemetry/internal/story_runner.py

Issue 2777093004: Reland of Track telemetry benchmark cycle time (Closed)
Patch Set: Fix bad return Created 3 years, 8 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 | « no previous file | telemetry/telemetry/internal/story_runner_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import logging 5 import logging
6 import optparse 6 import optparse
7 import os 7 import os
8 import subprocess 8 import subprocess
9 import sys 9 import sys
10 import time 10 import time
11 11
12 import py_utils 12 import py_utils
13 from py_utils import cloud_storage # pylint: disable=import-error 13 from py_utils import cloud_storage # pylint: disable=import-error
14 14
15 from telemetry.core import exceptions 15 from telemetry.core import exceptions
16 from telemetry import decorators 16 from telemetry import decorators
17 from telemetry.internal.actions import page_action 17 from telemetry.internal.actions import page_action
18 from telemetry.internal.browser import browser_finder 18 from telemetry.internal.browser import browser_finder
19 from telemetry.internal.results import results_options 19 from telemetry.internal.results import results_options
20 from telemetry.internal.util import exception_formatter 20 from telemetry.internal.util import exception_formatter
21 from telemetry import page 21 from telemetry import page
22 from telemetry.page import legacy_page_test 22 from telemetry.page import legacy_page_test
23 from telemetry import story as story_module 23 from telemetry import story as story_module
24 from telemetry.util import wpr_modes 24 from telemetry.util import wpr_modes
25 from telemetry.value import failure 25 from telemetry.value import failure
26 from telemetry.value import skip 26 from telemetry.value import skip
27 from telemetry.value import scalar
27 from telemetry.web_perf import story_test 28 from telemetry.web_perf import story_test
28 29
29 30
30 class ArchiveError(Exception): 31 class ArchiveError(Exception):
31 pass 32 pass
32 33
33 34
34 def AddCommandLineArgs(parser): 35 def AddCommandLineArgs(parser):
35 story_module.StoryFilter.AddCommandLineArgs(parser) 36 story_module.StoryFilter.AddCommandLineArgs(parser)
36 results_options.AddResultsOptions(parser) 37 results_options.AddResultsOptions(parser)
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 story.display_name) 295 story.display_name)
295 296
296 297
297 def RunBenchmark(benchmark, finder_options): 298 def RunBenchmark(benchmark, finder_options):
298 """Run this test with the given options. 299 """Run this test with the given options.
299 300
300 Returns: 301 Returns:
301 The number of failure values (up to 254) or 255 if there is an uncaught 302 The number of failure values (up to 254) or 255 if there is an uncaught
302 exception. 303 exception.
303 """ 304 """
305 start = time.time()
304 benchmark.CustomizeBrowserOptions(finder_options.browser_options) 306 benchmark.CustomizeBrowserOptions(finder_options.browser_options)
305 307
306 benchmark_metadata = benchmark.GetMetadata() 308 benchmark_metadata = benchmark.GetMetadata()
307 possible_browser = browser_finder.FindBrowser(finder_options) 309 possible_browser = browser_finder.FindBrowser(finder_options)
308 if not possible_browser: 310 if not possible_browser:
309 print ('Cannot find browser of type %s. To list out all ' 311 print ('Cannot find browser of type %s. To list out all '
310 'available browsers, rerun your command with ' 312 'available browsers, rerun your command with '
311 '--browser=list' % finder_options.browser_options.browser_type) 313 '--browser=list' % finder_options.browser_options.browser_type)
312 return 1 314 return 1
313 if (possible_browser and 315 if (possible_browser and
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 return_code = 255 370 return_code = 255
369 371
370 try: 372 try:
371 if finder_options.upload_results: 373 if finder_options.upload_results:
372 bucket = finder_options.upload_bucket 374 bucket = finder_options.upload_bucket
373 if bucket in cloud_storage.BUCKET_ALIASES: 375 if bucket in cloud_storage.BUCKET_ALIASES:
374 bucket = cloud_storage.BUCKET_ALIASES[bucket] 376 bucket = cloud_storage.BUCKET_ALIASES[bucket]
375 results.UploadTraceFilesToCloud(bucket) 377 results.UploadTraceFilesToCloud(bucket)
376 results.UploadProfilingFilesToCloud(bucket) 378 results.UploadProfilingFilesToCloud(bucket)
377 finally: 379 finally:
380 duration = time.time() - start
381 results.AddSummaryValue(scalar.ScalarValue(
382 None, 'BenchmarkDuration', 'minutes', duration / 60.0))
378 results.PrintSummary() 383 results.PrintSummary()
379 return return_code 384 return return_code
380 385
381 386
382 def _UpdateAndCheckArchives(archive_data_file, wpr_archive_info, 387 def _UpdateAndCheckArchives(archive_data_file, wpr_archive_info,
383 filtered_stories): 388 filtered_stories):
384 """Verifies that all stories are local or have WPR archives. 389 """Verifies that all stories are local or have WPR archives.
385 390
386 Logs warnings and returns False if any are missing. 391 Logs warnings and returns False if any are missing.
387 """ 392 """
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 logging.warning('Device is thermally throttled before running ' 461 logging.warning('Device is thermally throttled before running '
457 'performance tests, results will vary.') 462 'performance tests, results will vary.')
458 463
459 464
460 def _CheckThermalThrottling(platform): 465 def _CheckThermalThrottling(platform):
461 if not platform.CanMonitorThermalThrottling(): 466 if not platform.CanMonitorThermalThrottling():
462 return 467 return
463 if platform.HasBeenThermallyThrottled(): 468 if platform.HasBeenThermallyThrottled():
464 logging.warning('Device has been thermally throttled during ' 469 logging.warning('Device has been thermally throttled during '
465 'performance tests, results will vary.') 470 'performance tests, results will vary.')
OLDNEW
« no previous file with comments | « no previous file | telemetry/telemetry/internal/story_runner_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698