def CreateTimelineBasedMeasurementOptions(self): startup_category_filter = tracing_category_filter.TracingCategoryFilter( filter_string='startup,blink.user_timing') options = timeline_based_measurement.Options( overhead_level=startup_category_filter) options.SetTimelineBasedMetrics( [startup.StartupTimelineMetric()]) return options
def CreateCoreTimelineBasedMeasurementOptions(self): startup_category_filter = ( chrome_trace_category_filter.ChromeTraceCategoryFilter( filter_string='startup,blink.user_timing')) options = timeline_based_measurement.Options( overhead_level=startup_category_filter) options.SetLegacyTimelineBasedMetrics( [startup.StartupTimelineMetric()]) return options
def ComputeStartupMetrics(self): results = test_page_test_results.TestPageTestResults(self) # Create a mock model usable by # StartupTimelineMetric.AddWholeTraceResults(). def IterateEvents(event_predicate): for event in self.events: if event_predicate(event): yield event class MockClass(object): pass model = MockClass() model.browser_process = MockClass() model.browser_process.parent = MockClass() model.browser_process.parent.IterAllEvents = IterateEvents startup.StartupTimelineMetric().AddWholeTraceResults(model, results) return results