def ControllerAgentClockSync(issue_ts, name): """Record the clock sync marker for controller tracing agent. Unlike with the other tracing agents, the tracing controller should not call this directly. Rather, it is called via callback from the other tracing agents when they write a trace. """ trace_event.clock_sync(name, issue_ts=issue_ts)
def testFlushChanges(self): with self._test_trace(): with open(self._log_path, 'r') as f: trace_event.clock_sync('1') self.assertEquals(len(json.loads(f.read() + ']')), 1) f.seek(0) trace_event.trace_flush() self.assertEquals(len(json.loads(f.read() + ']')), 2)
def _RecordIssuerClockSyncMarker(self, sync_id, issue_ts): """ Record clock sync event. Args: sync_id: Unqiue id for sync event. issue_ts: timestamp before issuing clocksync to agent. """ trace_event.clock_sync(sync_id, issue_ts=issue_ts)
def testClockSyncWithoutTs(self): with self._test_trace(): with open(self._log_path, 'r') as f: trace_event.clock_sync('id') trace_event.trace_flush() log_output = json.loads(f.read() + ']') self.assertEquals(len(log_output), 2) current_entry = log_output.pop(0) self.assertEquals(current_entry['category'], 'process_argv') self.assertEquals(current_entry['name'], 'process_argv') self.assertTrue(current_entry['args']['argv']) self.assertEquals(current_entry['ph'], 'M') current_entry = log_output.pop(0) self.assertEquals(current_entry['category'], 'python') self.assertEquals(current_entry['name'], 'clock_sync') self.assertFalse(current_entry['args'].get('issue_ts')) self.assertEquals(current_entry['ph'], 'c')