Esempio n. 1
0
    def CreateCoreTimelineBasedMeasurementOptions(self):
        categories = [
            # Disable all categories by default.
            '-*',
            'toplevel',
            # WebRTC
            'webmediaplayerms',
        ]

        category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter(
            filter_string=','.join(categories))
        options = timeline_based_measurement.Options(category_filter)
        options.SetTimelineBasedMetrics([
            'cpuTimeMetric',
            'webrtcRenderingMetric',
        ])
        return options
Esempio n. 2
0
  def testSmoothnessTimelineBasedMeasurementForSmoke(self):
    ps = self.CreateEmptyPageSet()
    ps.AddStory(TestTimelinebasedMeasurementPage(
        ps, ps.base_dir, trigger_animation=True))

    options = tbm_module.Options()
    options.SetLegacyTimelineBasedMetrics([smoothness.SmoothnessMetric()])
    tbm = tbm_module.TimelineBasedMeasurement(options)
    results = self.RunMeasurement(tbm, ps, options=self._options)

    self.assertEquals(0, len(results.failures))
    v = results.FindAllPageSpecificValuesFromIRNamed(
        'CenterAnimation', 'frame_time_discrepancy')
    self.assertEquals(len(v), 1)
    v = results.FindAllPageSpecificValuesFromIRNamed(
        'DrawerAnimation', 'frame_time_discrepancy')
    self.assertEquals(len(v), 1)
Esempio n. 3
0
    def CreateCoreTimelineBasedMeasurementOptions(self):
        memory_categories = [
            'blink.console', 'disabled-by-default-memory-infra'
        ]
        gpu_categories = ['gpu']
        debug_categories = ['toplevel', 'viz']
        category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter(
            ','.join(['-*'] + memory_categories + gpu_categories +
                     debug_categories))
        options = timeline_based_measurement.Options(category_filter)
        options.config.enable_android_graphics_memtrack = True
        options.config.enable_platform_display_trace = True

        options.SetTimelineBasedMetrics(['memoryMetric', 'webvrMetric'])
        options.config.chrome_trace_config.SetMemoryDumpConfig(
            chrome_trace_config.MemoryDumpConfig())
        return options
Esempio n. 4
0
def CreateCoreTimelineBasedMemoryMeasurementOptions():
  """Creates necessary TBM options for measuring memory usage.

  Separated out so that code can be re-used in other benchmarks.
  """
  # Enable only memory-infra, to get memory dumps, and blink.console, to get
  # the timeline markers used for mapping threads to tabs.
  trace_memory = chrome_trace_category_filter.ChromeTraceCategoryFilter(
      filter_string='-*,blink.console,disabled-by-default-memory-infra')
  tbm_options = timeline_based_measurement.Options(
      overhead_level=trace_memory)
  tbm_options.config.enable_android_graphics_memtrack = True
  tbm_options.SetTimelineBasedMetrics(['memoryMetric'])
  # Setting an empty memory dump config disables periodic dumps.
  tbm_options.config.chrome_trace_config.SetMemoryDumpConfig(
      chrome_trace_config.MemoryDumpConfig())
  return tbm_options
Esempio n. 5
0
    def CreateTimelineBasedMeasurementOptions(self):
        category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter(
        )

        # 'toplevel' category provides CPU time slices used by # cpuTimeMetric.
        category_filter.AddIncludedCategory('toplevel')

        # 'rail' category is used by powerMetric to attribute different period of
        # time to different activities, such as video_animation, etc.
        category_filter.AddIncludedCategory('rail')

        options = timeline_based_measurement.Options(category_filter)
        options.config.enable_atrace_trace = True
        options.config.atrace_config.categories = ['sched']
        options.config.enable_battor_trace = True
        options.SetTimelineBasedMetrics(['powerMetric', 'cpuTimeMetric'])
        return options
Esempio n. 6
0
 def CreateCoreTimelineBasedMeasurementOptions(self):
   options = timeline_based_measurement.Options(
       chrome_trace_category_filter.ChromeTraceCategoryFilter(
           filter_string='rail,toplevel'))
   options.config.enable_battor_trace = True
   options.config.enable_chrome_trace = True
   options.config.enable_cpu_trace = True
   options.SetTimelineBasedMetrics([
       'clockSyncLatencyMetric',
       'cpuTimeMetric',
       'powerMetric',
       'tracingMetric'
   ])
   loading_metrics_category.AugmentOptionsForLoadingMetrics(options)
   # The EQT metric depends on the same categories as the loading metric.
   options.AddTimelineBasedMetric('expectedQueueingTimeMetric')
   return options
Esempio n. 7
0
    def CreateCoreTimelineBasedMeasurementOptions(self):
        cat_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter(
            filter_string='rail,toplevel')
        cat_filter.AddIncludedCategory('accessibility')
        # Needed for the console error metric.
        cat_filter.AddIncludedCategory('v8.console')

        options = timeline_based_measurement.Options(cat_filter)
        options.config.enable_chrome_trace = True
        options.config.enable_cpu_trace = True
        options.SetTimelineBasedMetrics([
            'accessibilityMetric', 'consoleErrorMetric', 'cpuTimeMetric',
            'limitedCpuTimeMetric', 'tracingMetric'
        ])
        loading_metrics_category.AugmentOptionsForLoadingMetrics(options)
        # The EQT metric depends on the same categories as the loading metric.
        options.AddTimelineBasedMetric('expectedQueueingTimeMetric')
        return options
Esempio n. 8
0
    def WillNavigateToPage(self, page, tab):
        # FIXME: Remove webkit.console when blink.console lands in chromium and
        # the ref builds are updated. crbug.com/386847
        custom_categories = [
            'webkit.console', 'blink.console', 'benchmark',
            'trace_event_overhead'
        ]
        category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter(
            ','.join(custom_categories))

        options = timeline_based_measurement.Options(category_filter)
        options.config.enable_platform_display_trace = True
        options.SetLegacyTimelineBasedMetrics([smoothness.SmoothnessMetric()])
        for delay in page.GetSyntheticDelayCategories():
            options.category_filter.AddSyntheticDelay(delay)
        self._tbm = timeline_based_measurement.TimelineBasedMeasurement(
            options, self._results_wrapper)
        self._tbm.WillRunStory(tab.browser.platform)
Esempio n. 9
0
    def CreateCoreTimelineBasedMeasurementOptions(self):
        cat_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter()

        # "blink.console" is used for marking ranges in
        # cache_temperature.MarkTelemetryInternal.
        cat_filter.AddIncludedCategory('blink.console')

        # "toplevel" category is used to capture TaskQueueManager events.
        cat_filter.AddIncludedCategory('toplevel')

        # V8 needed categories
        cat_filter.AddIncludedCategory('v8')
        cat_filter.AddDisabledByDefault('disabled-by-default-v8.runtime_stats')

        tbm_options = timeline_based_measurement.Options(
            overhead_level=cat_filter)
        tbm_options.SetTimelineBasedMetrics(['runtimeStatsTotalMetric'])
        return tbm_options
Esempio n. 10
0
 def CreateCoreTimelineBasedMeasurementOptions(self):
   category_filter = chrome_trace_category_filter.CreateLowOverheadFilter()
   options = timeline_based_measurement.Options(category_filter)
   options.config.chrome_trace_config.EnableUMAHistograms(
       'Event.Latency.ScrollBegin.Touch.TimeToScrollUpdateSwapBegin4',
       'Event.Latency.ScrollUpdate.Touch.TimeToScrollUpdateSwapBegin4',
       'Event.Latency.ScrollBegin.Wheel.TimeToScrollUpdateSwapBegin4',
       'Event.Latency.ScrollUpdate.Wheel.TimeToScrollUpdateSwapBegin4',
       'Graphics.Smoothness.Throughput.MainThread.PinchZoom',
       'Graphics.Smoothness.Throughput.MainThread.RAF',
       'Graphics.Smoothness.Throughput.MainThread.TouchScroll',
       'Graphics.Smoothness.Throughput.MainThread.WheelScroll',
       'Graphics.Smoothness.Throughput.CompositorThread.CompositorAnimation',
       'Graphics.Smoothness.Throughput.CompositorThread.PinchZoom',
       'Graphics.Smoothness.Throughput.CompositorThread.TouchScroll',
       'Graphics.Smoothness.Throughput.CompositorThread.WheelScroll')
   options.SetTimelineBasedMetrics(['renderingMetric', 'umaMetric'])
   return options
Esempio n. 11
0
 def CreateCoreTimelineBasedMeasurementOptions(self):
   category_filter = chrome_trace_category_filter.CreateLowOverheadFilter()
   # Supplement the base trace categories with "gpu.memory" which records
   # timings associated with memory ablation experiments.
   category_filter.AddFilterString('gpu.memory')
   category_filter.AddDisabledByDefault(
       'disabled-by-default-histogram_samples')
   options = timeline_based_measurement.Options(category_filter)
   options.config.chrome_trace_config.EnableUMAHistograms(
       *RENDERING_BENCHMARK_UMA)
   options.SetTimelineBasedMetrics([
       'renderingMetric',
       'umaMetric',
       # Unless --experimentatil-tbmv3-metric flag is used, the following tbmv3
       # metrics do nothing.
       'tbmv3:uma_metrics'
   ])
   return options
Esempio n. 12
0
 def CreateTimelineBasedMeasurementOptions(self):
   v8_categories = [
       'blink.console', 'disabled-by-default-v8.gc',
       'renderer.scheduler', 'v8', 'webkit.console']
   smoothness_categories = [
       'webkit.console', 'blink.console', 'benchmark', 'trace_event_overhead']
   memory_categories = ['blink.console', 'disabled-by-default-memory-infra']
   category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter(
       ','.join(['-*'] + v8_categories +
                smoothness_categories + memory_categories))
   options = timeline_based_measurement.Options(category_filter)
   # TODO(ulan): Add frame time discrepancy once it is ported to TBMv2,
   # see crbug.com/606841.
   options.SetTimelineBasedMetrics(['v8AndMemoryMetrics'])
   # Setting an empty memory dump config disables periodic dumps.
   options.config.chrome_trace_config.SetMemoryDumpConfig(
       chrome_trace_config.MemoryDumpConfig())
   return options
    def testSmoothnessTimelineBasedMeasurementForSmoke(self):
        ps = self.CreateEmptyPageSet()
        ps.AddUserStory(
            TestTimelinebasedMeasurementPage(ps,
                                             ps.base_dir,
                                             trigger_animation=True))

        tbm = tbm_module.TimelineBasedMeasurement(tbm_module.Options())
        measurement = tbm_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)
Esempio n. 14
0
    def CreateCoreTimelineBasedMeasurementOptions(self):
        categories = [
            # Disable all categories by default.
            '-*',
            # Memory categories.
            'disabled-by-default-memory-infra',
            # UE categories requred by runtimeStatsTotalMetric to bucket
            # runtimeStats by UE.
            'rail',
            # EQT categories.
            'blink.user_timing',
            'loading',
            'navigation',
            'toplevel',
            # V8 categories.
            'blink.console',
            'disabled-by-default-v8.gc',
            'renderer.scheduler',
            'v8',
            'webkit.console',
            'disabled-by-default-v8.runtime_stats',
            # TODO(crbug.com/616441, primiano): Remove this temporary workaround,
            # which enables memory-infra V8 code stats in V8 code size benchmarks
            # only (to not slow down detailed memory dumps in other benchmarks).
            'disabled-by-default-memory-infra.v8.code_stats',
            # Blink categories.
            'blink_gc',
        ]
        options = timeline_based_measurement.Options(
            chrome_trace_category_filter.ChromeTraceCategoryFilter(
                ','.join(categories)))
        options.config.enable_android_graphics_memtrack = True
        # Trigger periodic light memory dumps every 1000 ms.
        memory_dump_config = chrome_trace_config.MemoryDumpConfig()
        memory_dump_config.AddTrigger('light', 1000)
        options.config.chrome_trace_config.SetMemoryDumpConfig(
            memory_dump_config)

        options.SetTimelineBasedMetrics([
            'expectedQueueingTimeMetric', 'runtimeStatsTotalMetric',
            'gcMetric', 'blinkGcMetric', 'memoryMetric'
        ])
        return options
Esempio n. 15
0
    def CreateTimelineBasedMeasurementOptions(self):
        categories = [
            # Disable all categories by default.
            '-*',
            'toplevel',
            # WebRTC
            # TODO(ehmaldonado): Re-enable once http://crbug.com/725502 is fixed.
            # 'webrtc',
        ]

        category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter(
            filter_string=','.join(categories))
        options = timeline_based_measurement.Options(category_filter)
        options.SetTimelineBasedMetrics([
            'cpuTimeMetric',
            # TODO(ehmaldonado): Re-enable once http://crbug.com/725502 is fixed.
            # 'webrtcRenderingMetric',
        ])
        return options
Esempio n. 16
0
    def testSuccessfulTimelineBasedMeasurementTest(self):
        """Check that PageTest is not required for story_runner.Run.

    Any PageTest related calls or attributes need to only be called
    for PageTest tests.
    """
        class TestSharedTbmState(TestSharedState):
            def RunStory(self, results):
                pass

        test = timeline_based_measurement.TimelineBasedMeasurement(
            timeline_based_measurement.Options())
        story_set = story_module.StorySet()
        story_set.AddStory(DummyLocalStory(TestSharedTbmState))
        story_set.AddStory(DummyLocalStory(TestSharedTbmState))
        story_set.AddStory(DummyLocalStory(TestSharedTbmState))
        story_runner.Run(test, story_set, self.options, self.results)
        self.assertEquals(0, len(self.results.failures))
        self.assertEquals(3, GetNumberOfSuccessfulPageRuns(self.results))
  def testTBM2ForSmoke(self):
    ps = self.CreateEmptyPageSet()
    ps.AddStory(TestTimelinebasedMeasurementPage(ps, ps.base_dir))

    options = tbm_module.Options()
    options.SetTimelineBasedMetric('sampleMetric')

    tbm = tbm_module.TimelineBasedMeasurement(options)
    results = self.RunMeasurement(tbm, ps, self._options)

    self.assertEquals(0, len(results.failures))
    v_foo = results.FindAllPageSpecificValuesNamed('foo')
    v_bar = results.FindAllPageSpecificValuesNamed('bar')
    self.assertEquals(len(v_foo), 1)
    self.assertEquals(len(v_bar), 1)
    self.assertEquals(v_foo[0].value, 1)
    self.assertIsNotNone(v_foo[0].page)
    self.assertEquals(v_bar[0].value, 2)
    self.assertIsNotNone(v_bar[0].page)
Esempio n. 18
0
    def testTBM2ForSmoke(self):
        ps = self.CreateEmptyPageSet()
        ps.AddStory(
            TestTimelinebasedMeasurementPage(
                ps, ps.base_dir, additional_metrics=['sampleMetric']))

        options = tbm_module.Options()
        options.config.enable_chrome_trace = True

        tbm = tbm_module.TimelineBasedMeasurement(options)
        results = self.RunMeasurement(tbm, ps, self._options)
        self.assertFalse(results.had_failures)
        tbm_metrics = []
        for story_run in results.IterStoryRuns():
            tbm_metrics += story_run.tbm_metrics
        self.assertEqual(tbm_metrics, ['sampleMetric'])
        histogram_dicts = results.AsHistogramDicts()
        hs = histogram_set.HistogramSet()
        hs.ImportDicts(histogram_dicts)
        self.assertEquals(4, len(hs))
        hist = hs.GetFirstHistogram()
        benchmarks = hist.diagnostics.get(reserved_infos.BENCHMARKS.name)
        self.assertIsInstance(benchmarks, generic_set.GenericSet)
        self.assertEquals(1, len(benchmarks))
        self.assertEquals(page_test_test_case.BENCHMARK_NAME,
                          list(benchmarks)[0])
        stories = hist.diagnostics.get(reserved_infos.STORIES.name)
        self.assertIsInstance(stories, generic_set.GenericSet)
        self.assertEquals(1, len(stories))
        self.assertEquals('interaction_enabled_page.html', list(stories)[0])
        repeats = hist.diagnostics.get(reserved_infos.STORYSET_REPEATS.name)
        self.assertIsInstance(repeats, generic_set.GenericSet)
        self.assertEquals(1, len(repeats))
        self.assertEquals(0, list(repeats)[0])
        hist = hs.GetFirstHistogram()
        trace_start = hist.diagnostics.get(reserved_infos.TRACE_START.name)
        self.assertIsInstance(trace_start, date_range.DateRange)

        v_foo = results.FindAllPageSpecificValuesNamed('foo_avg')
        self.assertEquals(len(v_foo), 1)
        self.assertEquals(v_foo[0].value, 50)
        self.assertIsNotNone(v_foo[0].page)
  def testGPUTimesTimelineBasedMeasurementForSmoke(self):
    ps = self.CreateEmptyPageSet()
    ps.AddStory(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)
    results = self.RunMeasurement(tbm, ps, options=self._options)

    self.assertEquals(0, len(results.failures))
    v = results.FindAllPageSpecificValuesFromIRNamed(
        'CenterAnimation', 'browser_compositor_max_cpu_time')
    self.assertEquals(len(v), 1)
    self.assertGreater(v[0].value, 0)
    v = results.FindAllPageSpecificValuesFromIRNamed(
        'DrawerAnimation', 'browser_compositor_max_cpu_time')
    self.assertEquals(len(v), 1)
    self.assertGreater(v[0].value, 0)
Esempio n. 20
0
 def CreateTimelineBasedMeasurementOptions(self):
     category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter(
         filter_string='toplevel')
     options = timeline_based_measurement.Options(category_filter)
     options.config.chrome_trace_config.category_filter.AddFilterString(
         'rail')
     # TODO(charliea): Reenable the CPU tracing agent once it no longer causes
     # indefinite hangs on Windows.
     # https://crbug.com/647443
     # TODO(charliea): Reenable BattOr tracing on the main perf waterfall once
     # the BattOrs stop crashing as their SD cards fill up.
     # crbug.com/652384
     options.config.enable_battor_trace = (
         os.environ.get('BUILDBOT_MASTERNAME') == 'chromium.perf.fyi')
     options.config.enable_chrome_trace = True
     options.config.enable_atrace_trace = True
     options.config.atrace_config.categories = ['sched']
     options.SetTimelineBasedMetrics(
         ['powerMetric', 'clockSyncLatencyMetric', 'cpuTimeMetric'])
     return options
Esempio n. 21
0
    def CreateCoreTimelineBasedMeasurementOptions(self):
        category_filter = chrome_trace_category_filter.CreateLowOverheadFilter(
        )
        tbm_options = timeline_based_measurement.Options(category_filter)
        uma_histograms = [
            'Ads.ResourceUsage.Size.Network.Mainframe.AdResource',
            'Ads.ResourceUsage.Size.Network.Mainframe.VanillaResource',
            'Ads.ResourceUsage.Size.Network.Subframe.AdResource',
            'Ads.ResourceUsage.Size.Network.Subframe.VanillaResource',
            'PageLoad.Clients.Ads.Cpu.AdFrames.Aggregate.TotalUsage',
            'PageLoad.Clients.Ads.Cpu.FullPage.TotalUsage',
            'PageLoad.Clients.Ads.Resources.Bytes.Ads2',
            'PageLoad.Experimental.Bytes.NetworkIncludingHeaders',
        ]
        for histogram in uma_histograms:
            tbm_options.config.chrome_trace_config.EnableUMAHistograms(
                histogram)

        tbm_options.SetTimelineBasedMetrics(['umaMetric', 'cpuTimeMetric'])
        return tbm_options
Esempio n. 22
0
 def CreateTimelineBasedMeasurementOptions(self):
     # Enable only memory-infra, to get memory dumps, and blink.console, to get
     # the timeline markers used for mapping threads to tabs.
     trace_memory = tracing_category_filter.TracingCategoryFilter(
         filter_string='-*,blink.console,disabled-by-default-memory-infra')
     tbm_options = timeline_based_measurement.Options(
         overhead_level=trace_memory)
     tbm_options.config.enable_android_graphics_memtrack = True
     if self.TBM_VERSION == 1:
         # TBMv1 (see telemetry/telemetry/web_perf/metrics/memory_timeline.py
         # in third_party/catapult).
         tbm_options.SetLegacyTimelineBasedMetrics(
             (memory_timeline.MemoryTimelineMetric(), ))
     elif self.TBM_VERSION == 2:
         # TBMv2 (see tracing/tracing/metrics/system_health/memory_metric.html
         # in third_party/catapult).
         tbm_options.SetTimelineBasedMetric('memoryMetric')
     else:
         raise Exception('Unrecognized TBM version: %s' % self.TBM_VERSION)
     return tbm_options
Esempio n. 23
0
 def CreateTimelineBasedMeasurementOptions(self):
     v8_categories = [
         'blink.console', 'disabled-by-default-v8.gc', 'renderer.scheduler',
         'v8', 'webkit.console'
     ]
     smoothness_categories = [
         'webkit.console', 'blink.console', 'benchmark',
         'trace_event_overhead'
     ]
     memory_categories = [
         'blink.console', 'disabled-by-default-memory-infra'
     ]
     category_filter = tracing_category_filter.TracingCategoryFilter(
         ','.join(['-*'] + v8_categories + smoothness_categories +
                  memory_categories))
     options = timeline_based_measurement.Options(category_filter)
     # TODO(ulan): Add frame time discrepancy once it is ported to TBMv2,
     # see crbug.com/606841.
     options.SetTimelineBasedMetric('v8AndMemoryMetrics')
     return options
  def testSuccessfulTimelineBasedMeasurementTest(self):
    """Check that PageTest is not required for story_runner.Run.

    Any PageTest related calls or attributes need to only be called
    for PageTest tests.
    """
    class TestSharedTbmState(TestSharedState):
      def RunStory(self, results):
        pass

    TEST_WILL_RUN_STORY = 'test.WillRunStory'
    TEST_MEASURE = 'test.Measure'
    TEST_DID_RUN_STORY = 'test.DidRunStory'

    EXPECTED_CALLS_IN_ORDER = [TEST_WILL_RUN_STORY,
                               TEST_MEASURE,
                               TEST_DID_RUN_STORY]

    test = timeline_based_measurement.TimelineBasedMeasurement(
        timeline_based_measurement.Options())

    manager = mock.MagicMock()
    test.WillRunStory = mock.MagicMock()
    test.Measure = mock.MagicMock()
    test.DidRunStory = mock.MagicMock()
    manager.attach_mock(test.WillRunStory, TEST_WILL_RUN_STORY)
    manager.attach_mock(test.Measure, TEST_MEASURE)
    manager.attach_mock(test.DidRunStory, TEST_DID_RUN_STORY)

    story_set = story_module.StorySet()
    story_set.AddStory(DummyLocalStory(TestSharedTbmState, name='foo'))
    story_set.AddStory(DummyLocalStory(TestSharedTbmState, name='bar'))
    story_set.AddStory(DummyLocalStory(TestSharedTbmState, name='baz'))
    story_runner.Run(
        test, story_set, self.options, self.results,
        metadata=EmptyMetadataForTest())
    self.assertEquals(0, len(self.results.failures))
    self.assertEquals(3, GetNumberOfSuccessfulPageRuns(self.results))

    self.assertEquals(3*EXPECTED_CALLS_IN_ORDER,
                      [call[0] for call in manager.mock_calls])
  def testMainthreadJankTimelineBasedMeasurement(self):
    ps = self.CreateEmptyPageSet()
    ps.AddStory(TestTimelinebasedMeasurementPage(
        ps, ps.base_dir, trigger_jank=True))

    tbm = tbm_module.TimelineBasedMeasurement(tbm_module.Options())
    results = self.RunMeasurement(tbm, 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.FindAllPageSpecificValuesFromIRNamed(
        'JankThreadJSRun', 'responsive-biggest_jank_thread_time')
    self.assertGreaterEqual(v[0].value, 50)

    v = results.FindAllPageSpecificValuesFromIRNamed(
        'JankThreadJSRun', 'responsive-total_big_jank_thread_time')
    self.assertGreaterEqual(v[0].value, 50)
Esempio n. 26
0
 def CreateTimelineBasedMeasurementOptions(self):
     v8_categories = [
         'blink.console', 'renderer.scheduler', 'v8', 'webkit.console'
     ]
     smoothness_categories = [
         'webkit.console', 'blink.console', 'benchmark',
         'trace_event_overhead'
     ]
     categories = list(set(v8_categories + smoothness_categories))
     memory_categories = 'blink.console,disabled-by-default-memory-infra'
     category_filter = tracing_category_filter.TracingCategoryFilter(
         memory_categories)
     for category in categories:
         category_filter.AddIncludedCategory(category)
     options = timeline_based_measurement.Options(category_filter)
     options.SetLegacyTimelineBasedMetrics([
         v8_gc_latency.V8GCLatency(),
         v8_execution.V8ExecutionMetric(),
         smoothness.SmoothnessMetric(),
         memory_timeline.MemoryTimelineMetric()
     ])
     return options
Esempio n. 27
0
  def CreateCoreTimelineBasedMeasurementOptions(self):
    category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter()

    # 'toplevel' category provides CPU time slices used by # cpuTimeMetric.
    category_filter.AddIncludedCategory('toplevel')

    # Collect media related events required by mediaMetric.
    category_filter.AddIncludedCategory('media')

    # Collect memory data.
    category_filter.AddDisabledByDefault('disabled-by-default-memory-infra')

    options = timeline_based_measurement.Options(category_filter)
    options.config.enable_android_graphics_memtrack = True

    # Setting an empty memory dump config disables periodic dumps.
    options.config.chrome_trace_config.SetMemoryDumpConfig(
        chrome_trace_config.MemoryDumpConfig())

    options.SetTimelineBasedMetrics(['mediaMetric', 'cpuTimeMetric',
                                     'memoryMetric'])
    return options
Esempio n. 28
0
def TimelineBasedMeasurementOptionsForLoadingMetric():
    cat_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter()

    # "blink.console" is used for marking ranges in
    # cache_temperature.MarkTelemetryInternal.
    cat_filter.AddIncludedCategory('blink.console')

    # "navigation" and "blink.user_timing" are needed to capture core
    # navigation events.
    cat_filter.AddIncludedCategory('navigation')
    cat_filter.AddIncludedCategory('blink.user_timing')

    # "loading" is needed for first-meaningful-paint computation.
    cat_filter.AddIncludedCategory('loading')

    # "toplevel" category is used to capture TaskQueueManager events
    # necessary to compute time-to-interactive.
    cat_filter.AddIncludedCategory('toplevel')

    tbm_options = timeline_based_measurement.Options(overhead_level=cat_filter)
    tbm_options.SetTimelineBasedMetrics(['loadingMetric'])
    return tbm_options
Esempio n. 29
0
    def CreateCoreTimelineBasedMeasurementOptions(self):
        category_filter = chrome_trace_category_filter.CreateLowOverheadFilter(
        )
        if self.enable_memory_metric:
            tbm_options = memory.CreateCoreTimelineBasedMemoryMeasurementOptions(
            )

            # The memory options only include the filters needed for memory
            # measurement. We reintroduce the filters required for other metrics.
            tbm_options.ExtendTraceCategoryFilter(
                category_filter.filter_string.split(','))
        else:
            tbm_options = timeline_based_measurement.Options(category_filter)

        uma_histograms = [
            'Ads.ResourceUsage.Size.Network.Mainframe.AdResource',
            'Ads.ResourceUsage.Size.Network.Mainframe.VanillaResource',
            'Ads.ResourceUsage.Size.Network.Subframe.AdResource',
            'Ads.ResourceUsage.Size.Network.Subframe.VanillaResource',
            'PageLoad.Clients.Ads.AllPages.NonAdNetworkBytes',
            'PageLoad.Clients.Ads.AllPages.PercentNetworkBytesAds',
            'PageLoad.Clients.Ads.Cpu.AdFrames.Aggregate.TotalUsage',
            'PageLoad.Clients.Ads.Cpu.FullPage.TotalUsage',
            'PageLoad.Clients.Ads.FrameCounts.AdFrames.Total',
            'PageLoad.Clients.Ads.Resources.Bytes.Ads2',
            'PageLoad.Cpu.TotalUsage',
            'PageLoad.Experimental.Bytes.NetworkIncludingHeaders',
            'PageLoad.PaintTiming.NavigationToFirstContentfulPaint',
        ]
        uma_histograms.extend(self.additional_histograms)
        for histogram in uma_histograms:
            tbm_options.config.chrome_trace_config.EnableUMAHistograms(
                histogram)

        tbm_options.AddTimelineBasedMetric('umaMetric')
        if self.enable_limited_cpu_time_metric:
            tbm_options.AddTimelineBasedMetric('limitedCpuTimeMetric')

        return tbm_options
    def testTBM2ForSmoke(self):
        ps = self.CreateEmptyPageSet()
        ps.AddStory(TestTimelinebasedMeasurementPage(ps, ps.base_dir))

        options = tbm_module.Options()
        options.config.enable_chrome_trace = True
        options.SetTimelineBasedMetric('sampleMetric')

        tbm = tbm_module.TimelineBasedMeasurement(options)
        results = self.RunMeasurement(tbm, ps, self._options)

        self.assertEquals(0, len(results.failures))
        self.assertEquals(9, len(results.value_set))
        self.assertEquals(1, len(results.value_set[0]['diagnostics']))
        iter_info = results.value_set[0]['diagnostics']['iteration']
        self.assertEqual('IterationInfo', iter_info['type'])
        self.assertEqual('', iter_info['benchmarkName'])
        self.assertEqual('interaction_enabled_page.html',
                         iter_info['storyDisplayName'])
        self.assertEqual({}, iter_info['storyGroupingKeys'])
        self.assertEqual(0, iter_info['storyRepeatCounter'])
        self.assertEqual(0, iter_info['storysetRepeatCounter'])
        self.assertEqual('file://interaction_enabled_page.html',
                         iter_info['storyUrl'])
        v_foo = results.FindAllPageSpecificValuesNamed('foo')
        v_bar = results.FindAllPageSpecificValuesNamed('bar')
        v_baz_avg = results.FindAllPageSpecificValuesNamed('baz_avg')
        v_baz_sum = results.FindAllPageSpecificValuesNamed('baz_sum')
        v_baz_count = results.FindAllPageSpecificValuesNamed('baz_count')
        self.assertEquals(len(v_foo), 1)
        self.assertEquals(len(v_bar), 1)
        self.assertEquals(v_foo[0].value, 1)
        self.assertIsNotNone(v_foo[0].page)
        self.assertEquals(v_bar[0].value, 2)
        self.assertIsNotNone(v_bar[0].page)
        self.assertEquals(len(v_baz_avg), 1)
        self.assertEquals(len(v_baz_sum), 1)
        self.assertEquals(len(v_baz_count), 1)