def _GetAllTimelineBasedMetrics(): # TODO(nednguyen): use discovery pattern to return all the instances of # all TimelineBasedMetrics class in web_perf/metrics/ folder. # This cannot be done until crbug.com/460208 is fixed. return (smoothness.SmoothnessMetric(), responsiveness_metric.ResponsivenessMetric(), layout.LayoutMetric(), gpu_timeline.GPUTimelineMetric(), blob_timeline.BlobTimelineMetric(), memory_timeline.MemoryTimelineMetric())
def _GetAllTimelineBasedMetrics(): # TODO(nednguyen): use discovery pattern to return all the instances of # all TimelineBasedMetrics class in web_perf/metrics/ folder. # This cannot be done until crbug.com/460208 is fixed. return (smoothness.SmoothnessMetric(), responsiveness_metric.ResponsivenessMetric(), layout.LayoutMetric(), gpu_timeline.GPUTimelineMetric(), blob_timeline.BlobTimelineMetric(), memory_timeline.MemoryTimelineMetric(), text_selection.TextSelectionMetric(), indexeddb_timeline.IndexedDBTimelineMetric(), webrtc_rendering_timeline.WebRtcRenderingTimelineMetric())
def getResultsDict(self, model, interactions): def strip_prefix(key, prefix): self.assertTrue(key.startswith(prefix)) return key[len(prefix):] results = page_test_results.PageTestResults() test_page = page.Page('http://google.com') results.WillRunPage(test_page) metric = memory_timeline.MemoryTimelineMetric() metric.AddResults(model, None, interactions, results) result_dict = {strip_prefix(v.name, 'memory_'): v.values for v in results.current_page_run.values} results.DidRunPage(test_page) return result_dict
def CreateTimelineBasedMeasurementOptions(self): v8_gc_latency_categories = [ 'blink.console', 'renderer.scheduler', 'v8', 'webkit.console'] smoothness_categories = [ 'webkit.console', 'blink.console', 'benchmark', 'trace_event_overhead'] categories = list(set(v8_gc_latency_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.SetTimelineBasedMetrics([v8_gc_latency.V8GCLatency(), smoothness.SmoothnessMetric(), memory_timeline.MemoryTimelineMetric()]) return options
def getResultsDict(self, model, interactions): def strip_prefix(key): if key.startswith('memory_'): return key[len('memory_'):] elif key.endswith('_count'): return key else: self.fail('Unexpected key: %r' % key) results = page_test_results.PageTestResults() test_page = page.Page('http://google.com') results.WillRunPage(test_page) metric = memory_timeline.MemoryTimelineMetric() metric.AddResults(model, None, interactions, results) result_dict = { strip_prefix(v.name): v.values for v in results.current_page_run.values } results.DidRunPage(test_page) return result_dict
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
def getResultsDict(self, model, interactions, renderer_pid=1234): def strip_prefix(key): if key.startswith('memory_'): return key[len('memory_'):] elif key.startswith('process_count_'): return key else: self.fail('Unexpected key: %r' % key) mock_thread = mock.Mock() mock_thread.parent.pid = renderer_pid results = page_test_results.PageTestResults() test_page = page.Page('http://google.com') results.WillRunPage(test_page) metric = memory_timeline.MemoryTimelineMetric() metric.AddResults(model, mock_thread, interactions, results) result_dict = {strip_prefix(v.name): v.values for v in results.current_page_run.values} results.DidRunPage(test_page) return result_dict
def SetupBenchmarkDefaultTraceRerunOptions(self, tbm_options): tbm_options.SetLegacyTimelineBasedMetrics( (memory_timeline.MemoryTimelineMetric(), ))