def AddResults(self, tab, results): absolute_browser_main_entry_ms = self._GetBrowserMainEntryTime(tab) process_creation_to_window_display_ms = histogram_util.GetHistogramSum( histogram_util.BROWSER_HISTOGRAM, 'Startup.BrowserWindowDisplay', tab) absolute_foreground_tab_loaded_ms, absolute_all_tabs_loaded_ms = \ self._GetTabLoadTimes(tab.browser) process_creation_to_messageloop_start_ms = histogram_util.GetHistogramSum( histogram_util.BROWSER_HISTOGRAM, 'Startup.BrowserMessageLoopStartTime', tab) main_to_messageloop_start_ms = histogram_util.GetHistogramSum( histogram_util.BROWSER_HISTOGRAM, 'Startup.BrowserMessageLoopStartTimeFromMainEntry', tab) process_creation_to_main = (process_creation_to_messageloop_start_ms - main_to_messageloop_start_ms) # User visible. results.Add('process_creation_to_window_display', 'ms', process_creation_to_window_display_ms) results.Add('process_creation_to_foreground_tab_loaded', 'ms', absolute_foreground_tab_loaded_ms - absolute_browser_main_entry_ms + process_creation_to_main) results.Add('process_creation_to_all_tabs_loaded', 'ms', absolute_all_tabs_loaded_ms - absolute_browser_main_entry_ms + process_creation_to_main) # Critical code progression. results.Add('process_creation_to_main', 'ms', process_creation_to_main) results.Add('main_to_messageloop_start', 'ms', main_to_messageloop_start_ms)
def _GetBrowserMainEntryTime(self, tab): """Returns the main entry time (in ms) of the browser.""" histogram_type = histogram_util.BROWSER_HISTOGRAM high_bytes = histogram_util.GetHistogramSum( histogram_type, 'Startup.BrowserMainEntryTimeAbsoluteHighWord', tab) low_bytes = histogram_util.GetHistogramSum( histogram_type, 'Startup.BrowserMainEntryTimeAbsoluteLowWord', tab) if high_bytes == 0 and low_bytes == 0: return None return (int(high_bytes) << 32) | (int(low_bytes) << 1)