Exemple #1
0
 def RecordClockSyncMarker(self, sync_id,
                           record_controller_clock_sync_marker_callback):
     devtools_clients = (
         chrome_tracing_devtools_manager.GetActiveDevToolsClients(
             self._platform_backend))
     if not devtools_clients:
         raise ChromeClockSyncError(
             'Cannot issue clock sync. No devtools clients')
     version = None
     for client in devtools_clients:
         version = client.GetChromeBranchNumber()
         break
     logging.info('Chrome version: %s', version)
     # Note, we aren't sure whether 2744 is the correct cut-off point which
     # Chrome will support clock sync marker, however we verified that 2743 does
     # not support clock sync (catapult/issues/2804) hence we use it here.
     # On the next update of Chrome ref build, if testTBM2ForSmoke still fails,
     # the cut-off branch number will need to be bumped up again.
     if version and int(version) > 2743:
         self._RecordClockSyncMarkerDevTools(
             sync_id, record_controller_clock_sync_marker_callback,
             devtools_clients)
     else:  # TODO(rnephew): Remove once chrome stable is past branch 2743.
         self._RecordClockSyncMarkerAsyncEvent(
             sync_id, record_controller_clock_sync_marker_callback)
    def RecordClockSyncMarker(self, sync_id,
                              record_controller_clock_sync_marker_callback):
        devtools_clients = (
            chrome_tracing_devtools_manager.GetActiveDevToolsClients(
                self._platform_backend))
        if not devtools_clients:
            logging.info('No devtools clients for issuing clock sync.')
            return False

        has_clock_synced = False
        for client in devtools_clients:
            try:
                timestamp = trace_time.Now()
                client.RecordChromeClockSyncMarker(sync_id)
                # We only need one successful clock sync.
                has_clock_synced = True
                break
            except Exception:  # pylint: disable=broad-except
                logging.exception(
                    'Failed to record clock sync marker with sync_id=%r '
                    'via DevTools client %r:', sync_id, client)
        if not has_clock_synced:
            raise ChromeClockSyncError(
                'Failed to issue clock sync to devtools client')
        record_controller_clock_sync_marker_callback(sync_id, timestamp)
        return True
 def _StartDevToolsTracing(self, config, timeout):
     devtools_clients = (
         chrome_tracing_devtools_manager.GetActiveDevToolsClients(
             self._platform_backend))
     if not devtools_clients:
         return False
     for client in devtools_clients:
         if client.is_tracing_running:
             raise ChromeTracingStartedError(
                 'Tracing is already running on devtools at port %s on platform'
                 'backend %s.' %
                 (client.remote_port, self._platform_backend))
         client.StartChromeTracing(config, timeout)
     return True
Exemple #4
0
 def RecordClockSyncMarker(self, sync_id,
                           record_controller_clock_sync_marker_callback):
     devtools_clients = (
         chrome_tracing_devtools_manager.GetActiveDevToolsClients(
             self._platform_backend))
     version = None
     for client in devtools_clients:
         version = client.GetChromeBranchNumber()
         break
     if version and int(version) >= 2661:
         self._RecordClockSyncMarkerDevTools(
             sync_id, record_controller_clock_sync_marker_callback,
             devtools_clients)
     else:  # TODO(rnephew): Remove once chrome stable is past branch 2661.
         self._RecordClockSyncMarkerAsyncEvent(
             sync_id, record_controller_clock_sync_marker_callback)
Exemple #5
0
 def _StartDevToolsTracing(self, trace_options, category_filter, timeout):
     if not chrome_tracing_devtools_manager.IsSupported(
             self._platform_backend):
         return False
     devtools_clients = (
         chrome_tracing_devtools_manager.GetActiveDevToolsClients(
             self._platform_backend))
     if not devtools_clients:
         return False
     for client in devtools_clients:
         if client.is_tracing_running:
             raise ChromeTracingStartedError(
                 'Tracing is already running on devtools at port %s on platform'
                 'backend %s.' %
                 (client.remote_port, self._platform_backend))
         client.StartChromeTracing(trace_options,
                                   category_filter.filter_string, timeout)
     return True