Exemple #1
0
    def __init__(self, test, finder_options, user_story_set):
        super(SharedPageState, self).__init__(test, finder_options,
                                              user_story_set)
        if isinstance(test,
                      timeline_based_measurement.TimelineBasedMeasurement):
            # This is to avoid the cyclic-import caused by timeline_based_page_test.
            from telemetry.web_perf import timeline_based_page_test
            self._test = timeline_based_page_test.TimelineBasedPageTest(test)
        else:
            self._test = test
        device_type = self._device_type or user_story_set.user_agent_type
        _PrepareFinderOptions(finder_options, self._test, device_type)
        self.browser = None
        self._finder_options = finder_options
        self._possible_browser = self._GetPossibleBrowser(
            self._test, finder_options)

        # TODO(slamm): Remove _append_to_existing_wpr when replay lifetime changes.
        self._append_to_existing_wpr = False
        self._first_browser = True
        self._did_login_for_current_page = False
        self._current_page = None
        self._current_tab = None

        self._test.SetOptions(self._finder_options)
Exemple #2
0
    def __init__(self, base_dir, target, args=None):
        self._base_dir = base_dir
        self._record_page_test = RecorderPageTest()
        self._options = self._CreateOptions()
        self._expectations = None

        self._benchmark = _MaybeGetInstanceOfClass(target, base_dir,
                                                   benchmark.Benchmark)
        self._parser = self._options.CreateParser(usage='See %prog --help')
        self._AddCommandLineArgs()
        self._ParseArgs(args)
        self._ProcessCommandLineArgs()
        if self._benchmark is not None:
            test = self._benchmark.CreatePageTest(self.options)
            if isinstance(test,
                          timeline_based_measurement.TimelineBasedMeasurement):
                test = timeline_based_page_test.TimelineBasedPageTest(test)
            # This must be called after the command line args are added.
            self._record_page_test.page_test = test
            self._expectations = self._benchmark.GetExpectations()

        self._page_set_base_dir = (self._options.page_set_base_dir
                                   if self._options.page_set_base_dir else
                                   self._base_dir)
        self._story_set = self._GetStorySet(target)
  def __init__(self, test, finder_options, story_set):
    super(SharedPageState, self).__init__(test, finder_options, story_set)
    if isinstance(test, timeline_based_measurement.TimelineBasedMeasurement):
      if finder_options.profiler:
        assert not 'trace' in finder_options.profiler, (
            'This is a Timeline Based Measurement benchmark. You cannot run it '
            'with trace profiler enabled. If you need trace data, tracing is '
            'always enabled in Timeline Based Measurement benchmarks and you '
            'can get the trace data by adding --output-format=json.')
      # This is to avoid the cyclic-import caused by timeline_based_page_test.
      from telemetry.web_perf import timeline_based_page_test
      self._test = timeline_based_page_test.TimelineBasedPageTest(test)
    else:
      self._test = test
    device_type = self._device_type
    # TODO(aiolos, nednguyen): Remove this logic of pulling out user_agent_type
    # from story_set once all page_set are converted to story_set
    # (crbug.com/439512).

    def _IsPageSetInstance(s):
      # This is needed to avoid importing telemetry.page.page_set which will
      # cause cyclic import.
      return 'PageSet' == s.__class__.__name__ or 'PageSet' in (
          list(c.__name__ for c in s.__class__.__bases__))
    if not device_type and _IsPageSetInstance(story_set):
      device_type = story_set.user_agent_type
    _PrepareFinderOptions(finder_options, self._test, device_type)
    self._browser = None
    self._finder_options = finder_options
    self._possible_browser = self._GetPossibleBrowser(
        self._test, finder_options)

    self._first_browser = True
    self._did_login_for_current_page = False
    self._previous_page = None
    self._current_page = None
    self._current_tab = None

    self._test.SetOptions(self._finder_options)

    # TODO(crbug/404771): Move network controller options out of
    # browser_options and into finder_options.
    browser_options = self._finder_options.browser_options
    if self._finder_options.use_live_sites:
      wpr_mode = wpr_modes.WPR_OFF
    elif browser_options.wpr_mode == wpr_modes.WPR_RECORD:
      wpr_mode = wpr_modes.WPR_RECORD
    else:
      wpr_mode = wpr_modes.WPR_REPLAY

    use_live_traffic = wpr_mode == wpr_modes.WPR_OFF

    if self.platform.network_controller.is_open:
      self.platform.network_controller.Close()
    self.platform.network_controller.InitializeIfNeeded(
        use_live_traffic=use_live_traffic)
    self.platform.network_controller.Open(wpr_mode,
                                          browser_options.extra_wpr_args)
    self.platform.Initialize()
    def __init__(self, test, finder_options, story_set):
        super(SharedPageState, self).__init__(test, finder_options, story_set)
        if isinstance(test,
                      timeline_based_measurement.TimelineBasedMeasurement):
            if finder_options.profiler:
                assert not 'trace' in finder_options.profiler, (
                    'This is a Timeline Based Measurement benchmark. You cannot run it '
                    'with trace profiler enabled. If you need trace data, tracing is '
                    'always enabled in Timeline Based Measurement benchmarks and you '
                    'can get the trace data by adding --output-format=json.')
            # This is to avoid the cyclic-import caused by timeline_based_page_test.
            from telemetry.web_perf import timeline_based_page_test
            self._test = timeline_based_page_test.TimelineBasedPageTest(test)
        else:
            self._test = test
        _PrepareFinderOptions(finder_options, self._test, self._device_type)
        self._browser = None
        self._finder_options = finder_options
        self._possible_browser = self._GetPossibleBrowser(
            self._test, finder_options)

        self._first_browser = True
        self._did_login_for_current_page = False
        self._previous_page = None
        self._current_page = None
        self._current_tab = None

        self._test.SetOptions(self._finder_options)

        # TODO(crbug/404771): Move network controller options out of
        # browser_options and into finder_options.
        browser_options = self._finder_options.browser_options
        if self._finder_options.use_live_sites:
            wpr_mode = wpr_modes.WPR_OFF
        elif browser_options.wpr_mode == wpr_modes.WPR_RECORD:
            wpr_mode = wpr_modes.WPR_RECORD
        else:
            wpr_mode = wpr_modes.WPR_REPLAY

        use_live_traffic = wpr_mode == wpr_modes.WPR_OFF

        if self.platform.network_controller.is_open:
            self.platform.network_controller.Close()
        self.platform.network_controller.InitializeIfNeeded(
            use_live_traffic=use_live_traffic)
        use_wpr_go = False
        if wpr_mode == wpr_modes.WPR_RECORD:
            use_wpr_go = self._finder_options.use_wpr_go
        elif self._finder_options.use_wpr_go:
            raise ValueError('Cannot set --use-wpr-go for non recording mode')
        elif wpr_mode == wpr_modes.WPR_REPLAY:
            use_wpr_go = (story_set.wpr_archive_info and
                          story_set.wpr_archive_info.is_using_wpr_go_archives)
        self.platform.network_controller.Open(wpr_mode,
                                              browser_options.extra_wpr_args,
                                              use_wpr_go=use_wpr_go)
        self.platform.Initialize()
    def __init__(self, test, finder_options, story_set):
        super(SharedPageState, self).__init__(test, finder_options, story_set)
        if isinstance(test,
                      timeline_based_measurement.TimelineBasedMeasurement):
            if finder_options.profiler:
                assert not 'trace' in finder_options.profiler, (
                    'This is a Timeline Based Measurement benchmark. You cannot run it '
                    'with trace profiler enabled. If you need trace data, tracing is '
                    'always enabled in Timeline Based Measurement benchmarks and you '
                    'can get the trace data with the default --output-format=html.'
                )
            # This is to avoid the cyclic-import caused by timeline_based_page_test.
            from telemetry.web_perf import timeline_based_page_test
            self._test = timeline_based_page_test.TimelineBasedPageTest(test)
        else:
            self._test = test

        if (self._device_type == 'desktop' and
                platform_module.GetHostPlatform().GetOSName() == 'chromeos'):
            self._device_type = 'chromeos'

        _PrepareFinderOptions(finder_options, self._test, self._device_type)
        self._browser = None
        self._finder_options = finder_options
        self._possible_browser = self._GetPossibleBrowser(
            self._test, finder_options)

        self._first_browser = True
        self._previous_page = None
        self._current_page = None
        self._current_tab = None

        self._test.SetOptions(self._finder_options)

        # TODO(crbug/404771): Move network controller options out of
        # browser_options and into finder_options.
        browser_options = self._finder_options.browser_options
        if self._finder_options.use_live_sites:
            wpr_mode = wpr_modes.WPR_OFF
        elif browser_options.wpr_mode == wpr_modes.WPR_RECORD:
            wpr_mode = wpr_modes.WPR_RECORD
        else:
            wpr_mode = wpr_modes.WPR_REPLAY
        self._extra_wpr_args = browser_options.extra_wpr_args

        self._simpleperf_controller = (
            browser_simpleperf_controller.BrowserSimpleperfController(
                process_name=finder_options.simpleperf_target,
                periods=finder_options.simpleperf_periods,
                frequency=finder_options.simpleperf_frequency))

        self.platform.SetFullPerformanceModeEnabled(
            finder_options.full_performance_mode)
        self.platform.network_controller.Open(wpr_mode)
        self.platform.Initialize()
    def __init__(self, test, finder_options, story_set):
        super(SharedPageState, self).__init__(test, finder_options, story_set)
        if isinstance(test,
                      timeline_based_measurement.TimelineBasedMeasurement):
            # This is to avoid the cyclic-import caused by timeline_based_page_test.
            from telemetry.web_perf import timeline_based_page_test
            self._test = timeline_based_page_test.TimelineBasedPageTest()
        else:
            self._test = test

        if (self._device_type == 'desktop' and
                platform_module.GetHostPlatform().GetOSName() == 'chromeos'):
            self._device_type = 'chromeos'

        _PrepareFinderOptions(finder_options, self._test, self._device_type)
        self._browser = None
        self._finder_options = finder_options
        self._possible_browser = self._GetPossibleBrowser(
            self._test, finder_options)

        self._first_browser = True
        self._previous_page = None
        self._current_page = None
        self._current_tab = None

        self._test.SetOptions(self._finder_options)

        # TODO(crbug/404771): Move network controller options out of
        # browser_options and into finder_options.
        browser_options = self._finder_options.browser_options
        if self._finder_options.use_live_sites:
            wpr_mode = wpr_modes.WPR_OFF
        elif browser_options.wpr_mode == wpr_modes.WPR_RECORD:
            wpr_mode = wpr_modes.WPR_RECORD
        else:
            wpr_mode = wpr_modes.WPR_REPLAY
        self._extra_wpr_args = browser_options.extra_wpr_args

        profiling_mod = browser_interval_profiling_controller
        self._interval_profiling_controller = (
            profiling_mod.BrowserIntervalProfilingController(
                possible_browser=self._possible_browser,
                process_name=finder_options.interval_profiling_target,
                periods=finder_options.interval_profiling_periods,
                frequency=finder_options.interval_profiling_frequency))

        self.platform.SetFullPerformanceModeEnabled(
            finder_options.full_performance_mode)
        self.platform.network_controller.Open(wpr_mode)
        self.platform.Initialize()
Exemple #7
0
    def testTimelineBasedMeasurementGestureAdjustmentSmoke(self):
        ps = self.CreateEmptyPageSet()
        ps.AddUserStory(
            TestTimelinebasedMeasurementPage(ps,
                                             ps.base_dir,
                                             trigger_scroll_gesture=True))

        tbm = tbm_module.TimelineBasedMeasurement(tbm_module.Options())
        measurement = tbpt_module.TimelineBasedPageTest(tbm)
        results = self.RunMeasurement(measurement, ps, options=self._options)

        self.assertEquals(0, len(results.failures))
        v = results.FindAllPageSpecificValuesNamed(
            'Gesture_Scroll-frame_time_discrepancy')
        self.assertEquals(len(v), 1)
Exemple #8
0
    def testSmoothnessTimelineBasedMeasurementForSmoke(self):
        ps = self.CreateEmptyPageSet()
        ps.AddUserStory(
            TestTimelinebasedMeasurementPage(ps,
                                             ps.base_dir,
                                             trigger_animation=True))

        tbm = tbm_module.TimelineBasedMeasurement(tbm_module.Options())
        measurement = tbpt_module.TimelineBasedPageTest(tbm)
        results = self.RunMeasurement(measurement, ps, options=self._options)

        self.assertEquals(0, len(results.failures))
        v = results.FindAllPageSpecificValuesNamed(
            'CenterAnimation-frame_time_discrepancy')
        self.assertEquals(len(v), 1)
        v = results.FindAllPageSpecificValuesNamed(
            'DrawerAnimation-frame_time_discrepancy')
        self.assertEquals(len(v), 1)
  def __init__(self, test, finder_options, story_set):
    super(SharedPageState, self).__init__(test, finder_options, story_set)
    if isinstance(test, timeline_based_measurement.TimelineBasedMeasurement):
      assert not finder_options.profiler, (
          'This is a Timeline Based Measurement benchmark. You cannot run it '
          'with the --profiler flag. If you need trace data, tracing is always '
          ' enabled in Timeline Based Measurement benchmarks and you can get '
          'the trace data by using --output-format=json.')
      # This is to avoid the cyclic-import caused by timeline_based_page_test.
      from telemetry.web_perf import timeline_based_page_test
      self._test = timeline_based_page_test.TimelineBasedPageTest(test)
    else:
      self._test = test
    device_type = self._device_type
    # TODO(aiolos, nednguyen): Remove this logic of pulling out user_agent_type
    # from story_set once all page_set are converted to story_set
    # (crbug.com/439512).

    def _IsPageSetInstance(s):
      # This is needed to avoid importing telemetry.page.page_set which will
      # cause cyclic import.
      return 'PageSet' == s.__class__.__name__ or 'PageSet' in (
          list(c.__name__ for c in s.__class__.__bases__))
    if not device_type and _IsPageSetInstance(story_set):
      device_type = story_set.user_agent_type
    _PrepareFinderOptions(finder_options, self._test, device_type)
    self._browser = None
    self._finder_options = finder_options
    self._possible_browser = self._GetPossibleBrowser(
        self._test, finder_options)

    # TODO(slamm): Remove _append_to_existing_wpr when replay lifetime changes.
    self._append_to_existing_wpr = False
    self._first_browser = True
    self._did_login_for_current_page = False
    self._current_page = None
    self._current_tab = None
    self._migrated_profile = None

    self._pregenerated_profile_archive_dir = None
    self._test.SetOptions(self._finder_options)
    def __init__(self, test, finder_options, story_set):
        super(SharedPageState, self).__init__(test, finder_options, story_set)
        if not issubclass(type(test), legacy_page_test.LegacyPageTest):
            # This is to avoid the cyclic-import caused by timeline_based_page_test.
            from telemetry.web_perf import timeline_based_page_test
            self._test = timeline_based_page_test.TimelineBasedPageTest()
        else:
            self._test = test

        if (self._device_type == 'desktop' and
                platform_module.GetHostPlatform().GetOSName() == 'chromeos'):
            self._device_type = 'chromeos'

        _PrepareFinderOptions(finder_options, self._test, self._device_type)
        self._browser = None
        self._finder_options = finder_options
        self._possible_browser = self._GetPossibleBrowser(
            self._test, finder_options)

        self._first_browser = True
        self._previous_page = None
        self._current_page = None
        self._current_tab = None

        self._test.SetOptions(self._finder_options)

        self._extra_wpr_args = self._finder_options.browser_options.extra_wpr_args

        profiling_mod = browser_interval_profiling_controller
        self._interval_profiling_controller = (
            profiling_mod.BrowserIntervalProfilingController(
                possible_browser=self._possible_browser,
                process_name=finder_options.interval_profiling_target,
                periods=finder_options.interval_profiling_periods,
                frequency=finder_options.interval_profiling_frequency))

        self.platform.SetFullPerformanceModeEnabled(
            finder_options.full_performance_mode)
        self.platform.network_controller.Open(self.wpr_mode)
        self.platform.Initialize()
Exemple #11
0
    def testGPUTimesTimelineBasedMeasurementForSmoke(self):
        ps = self.CreateEmptyPageSet()
        ps.AddUserStory(
            TestTimelinebasedMeasurementPage(ps,
                                             ps.base_dir,
                                             trigger_animation=True))

        cat_filter = tracing_category_filter.TracingCategoryFilter(
            'disabled-by-default-gpu.service')
        tbm_option = tbm_module.Options(overhead_level=cat_filter)
        tbm = tbm_module.TimelineBasedMeasurement(tbm_option)
        measurement = tbpt_module.TimelineBasedPageTest(tbm)
        results = self.RunMeasurement(measurement, ps, options=self._options)

        self.assertEquals(0, len(results.failures))
        v = results.FindAllPageSpecificValuesNamed(
            'CenterAnimation-browser_compositor_max_cpu_time')
        self.assertEquals(len(v), 1)
        self.assertGreater(v[0].value, 0)
        v = results.FindAllPageSpecificValuesNamed(
            'DrawerAnimation-browser_compositor_max_cpu_time')
        self.assertEquals(len(v), 1)
        self.assertGreater(v[0].value, 0)
Exemple #12
0
    def testMainthreadJankTimelineBasedMeasurement(self):
        ps = self.CreateEmptyPageSet()
        ps.AddUserStory(
            TestTimelinebasedMeasurementPage(ps,
                                             ps.base_dir,
                                             trigger_jank=True))

        tbm = tbm_module.TimelineBasedMeasurement(tbm_module.Options())
        measurement = tbpt_module.TimelineBasedPageTest(tbm)
        results = self.RunMeasurement(measurement, ps, options=self._options)
        self.assertEquals(0, len(results.failures))

        # In interaction_enabled_page.html, we create a jank loop based on
        # window.performance.now() (basically loop for x milliseconds).
        # Since window.performance.now() uses wall-time instead of thread time,
        # we only assert the biggest jank > 50ms here to account for the fact
        # that the browser may deschedule during the jank loop.
        v = results.FindAllPageSpecificValuesNamed(
            'JankThreadJSRun-responsive-biggest_jank_thread_time')
        self.assertGreaterEqual(v[0].value, 50)

        v = results.FindAllPageSpecificValuesNamed(
            'JankThreadJSRun-responsive-total_big_jank_thread_time')
        self.assertGreaterEqual(v[0].value, 50)