| OLD | NEW |
| 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.web_perf import story_test | 27 from telemetry.web_perf import story_test |
| 28 | 28 |
| 29 from tracing.metrics import all_histogram_names |
| 30 |
| 29 | 31 |
| 30 class ArchiveError(Exception): | 32 class ArchiveError(Exception): |
| 31 pass | 33 pass |
| 32 | 34 |
| 33 | 35 |
| 34 def AddCommandLineArgs(parser): | 36 def AddCommandLineArgs(parser): |
| 35 story_module.StoryFilter.AddCommandLineArgs(parser) | 37 story_module.StoryFilter.AddCommandLineArgs(parser) |
| 36 results_options.AddResultsOptions(parser) | 38 results_options.AddResultsOptions(parser) |
| 37 | 39 |
| 38 # Page set options | 40 # Page set options |
| (...skipping 23 matching lines...) Expand all Loading... |
| 62 story_module.StoryFilter.ProcessCommandLineArgs(parser, args) | 64 story_module.StoryFilter.ProcessCommandLineArgs(parser, args) |
| 63 results_options.ProcessCommandLineArgs(parser, args) | 65 results_options.ProcessCommandLineArgs(parser, args) |
| 64 | 66 |
| 65 if args.pageset_repeat < 1: | 67 if args.pageset_repeat < 1: |
| 66 parser.error('--pageset-repeat must be a positive integer.') | 68 parser.error('--pageset-repeat must be a positive integer.') |
| 67 | 69 |
| 68 | 70 |
| 69 def _RunStoryAndProcessErrorIfNeeded(story, results, state, test): | 71 def _RunStoryAndProcessErrorIfNeeded(story, results, state, test): |
| 70 def ProcessError(description=None): | 72 def ProcessError(description=None): |
| 71 state.DumpStateUponFailure(story, results) | 73 state.DumpStateUponFailure(story, results) |
| 72 results.AddValue(failure.FailureValue(story, sys.exc_info(), description)) | 74 if test.GetTimelineBasedMetrics(): |
| 75 for unused_name in all_histogram_names.AllHistogramNames( |
| 76 test.GetTimelineBasedMetrics()): |
| 77 pass # TODO(benjhayden): Synthesize Failure Histograms here. |
| 78 else: |
| 79 results.AddValue(failure.FailureValue(story, sys.exc_info(), description)) |
| 80 |
| 73 try: | 81 try: |
| 74 # TODO(mikecase): Remove this logging once Android perf bots are swarmed. | 82 # TODO(mikecase): Remove this logging once Android perf bots are swarmed. |
| 75 # crbug.com/678282 | 83 # crbug.com/678282 |
| 76 if state.platform.GetOSName() == 'android': | 84 if state.platform.GetOSName() == 'android': |
| 77 state.platform._platform_backend.Log( | 85 state.platform._platform_backend.Log( |
| 78 'START %s' % (story.name if story.name else str(story))) | 86 'START %s' % (story.name if story.name else str(story))) |
| 79 if isinstance(test, story_test.StoryTest): | 87 if isinstance(test, story_test.StoryTest): |
| 80 test.WillRunStory(state.platform) | 88 test.WillRunStory(state.platform) |
| 81 state.WillRunStory(story) | 89 state.WillRunStory(story) |
| 82 if not state.CanRunStory(story): | 90 if not state.CanRunStory(story): |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 logging.warning('Device is thermally throttled before running ' | 466 logging.warning('Device is thermally throttled before running ' |
| 459 'performance tests, results will vary.') | 467 'performance tests, results will vary.') |
| 460 | 468 |
| 461 | 469 |
| 462 def _CheckThermalThrottling(platform): | 470 def _CheckThermalThrottling(platform): |
| 463 if not platform.CanMonitorThermalThrottling(): | 471 if not platform.CanMonitorThermalThrottling(): |
| 464 return | 472 return |
| 465 if platform.HasBeenThermallyThrottled(): | 473 if platform.HasBeenThermallyThrottled(): |
| 466 logging.warning('Device has been thermally throttled during ' | 474 logging.warning('Device has been thermally throttled during ' |
| 467 'performance tests, results will vary.') | 475 'performance tests, results will vary.') |
| OLD | NEW |