def end(self, from_ms, dur_ms): self.trace.add_input_latency_event_slice( "GestureScrollEnd", ts=ms_to_ns(from_ms), dur=ms_to_ns(dur_ms), track=self.id, trace_id=self.id, gesture_scroll_id=self.gesture_id) self.id += 1 self.gesture_id += 1
def update(self, from_ms, dur_ms, gets_to_gpu=True): self.trace.add_input_latency_event_slice( "GestureScrollUpdate", ts=ms_to_ns(from_ms), dur=ms_to_ns(dur_ms), track=self.id, trace_id=self.id, gesture_scroll_id=self.gesture_id, gets_to_gpu=gets_to_gpu, is_coalesced=False, ) self.id += 1
thread1_counter = 60 touch_move_trace_id = 34576 trace_id1 = touch_move_trace_id + 1 trace_id2 = trace_id1 + 1 trace_id3 = trace_id2 + 1 touch_end_trace_id = trace_id3 + 1 touch_gesture_id = 87654 flow_id1 = 45678 flow_id2 = 45679 flow_id3 = 45680 trace.add_input_latency_event_slice("TouchStart", ts=ms_to_ns(0), dur=ms_to_ns(1), track=touch_move_trace_id, trace_id=touch_move_trace_id, touch_id=touch_gesture_id) trace.add_chrome_process_track_descriptor(process_track1, process_pid1) trace.add_chrome_thread_with_cpu_counter( process_track1, thread_track1, trusted_packet_sequence_id=seq1, counter_track=thread1_counter, pid=process_pid1, tid=thread_tid1, thread_type=trace.prototypes.ThreadDescriptor.ChromeThreadType.
import synth_common from synth_common import ms_to_ns trace = synth_common.create_trace() track1 = 1234 track2 = 1235 track3 = 1236 trace.add_track_descriptor(track1) trace.add_track_descriptor(track2) trace.add_track_descriptor(track3) trace.add_track_event_slice("AsyncSlice", ts=ms_to_ns(0), dur=ms_to_ns(10), track=track1) trace.add_track_event_slice("AsyncSlice", ts=ms_to_ns(10), dur=ms_to_ns(10), track=track2) trace.add_track_event_slice("AsyncSlice", ts=ms_to_ns(20), dur=ms_to_ns(10), track=track3) sys.stdout.buffer.write(trace.trace.SerializeToString())
thread_type=synth_common.CHROME_THREAD_MAIN) trace.add_chrome_thread_with_cpu_counter( process_track2, thread_track2, trusted_packet_sequence_id=seq2, counter_track=thread2_counter, pid=process_pid2, tid=thread_tid2, thread_type=synth_common.CHROME_THREAD_MAIN) trace.add_track_descriptor(rail_track1, parent=process_track1) trace.add_track_descriptor(rail_track2, parent=process_track2) trace.add_rail_mode_slice(ts=0, dur=ms_to_ns(10), track=rail_track1, mode=synth_common.RAIL_MODE_RESPONSE) trace.add_rail_mode_slice(ts=ms_to_ns(10), dur=ms_to_ns(20), track=rail_track1, mode=synth_common.RAIL_MODE_LOAD) trace.add_rail_mode_slice(ts=ms_to_ns(30), dur=-1, track=rail_track1, mode=synth_common.RAIL_MODE_IDLE) trace.add_rail_mode_slice(ts=0, dur=ms_to_ns(10), track=rail_track2, mode=synth_common.RAIL_MODE_ANIMATION)
thread_type=synth_common.CHROME_THREAD_MAIN) trace.add_chrome_thread_with_cpu_counter( process_track2, thread_track2, trusted_packet_sequence_id=seq2, counter_track=thread2_counter, pid=process_pid2, tid=thread_tid2, thread_type=synth_common.CHROME_THREAD_MAIN) trace.add_track_descriptor(rail_track1, parent=process_track1) trace.add_track_descriptor(rail_track2, parent=process_track2) trace.add_rail_mode_slice(ts=0, dur=ms_to_ns(10), track=rail_track1, mode=synth_common.RAIL_MODE_RESPONSE) trace.add_rail_mode_slice(ts=ms_to_ns(10), dur=ms_to_ns(20), track=rail_track1, mode=synth_common.RAIL_MODE_LOAD) trace.add_rail_mode_slice(ts=ms_to_ns(30), dur=-1, track=rail_track1, mode=synth_common.RAIL_MODE_IDLE) trace.add_track_event_slice("task", 0, ms_to_ns(10), trusted_sequence_id=seq2,
trace.add_chrome_thread_with_cpu_counter( process_track2, thread_track2, trusted_packet_sequence_id=seq2, counter_track=thread2_counter, pid=process_pid2, tid=thread_tid2, thread_type=trace.prototypes.ThreadDescriptor.ChromeThreadType .CHROME_THREAD_MAIN) trace.add_track_descriptor(rail_track1, parent=process_track1) trace.add_track_descriptor(rail_track2, parent=process_track2) trace.add_rail_mode_slice( ts=0, dur=ms_to_ns(10), track=rail_track1, mode=trace.prototypes.ChromeRAILMode.RAIL_MODE_RESPONSE) trace.add_rail_mode_slice( ts=ms_to_ns(10), dur=ms_to_ns(20), track=rail_track1, mode=trace.prototypes.ChromeRAILMode.RAIL_MODE_LOAD) trace.add_rail_mode_slice( ts=ms_to_ns(30), dur=-1, track=rail_track1, mode=trace.prototypes.ChromeRAILMode.RAIL_MODE_IDLE) trace.add_track_event_slice( "task",
thread1_counter = 60 scroll_begin_trace_id = 34576 trace_id1 = scroll_begin_trace_id + 1 trace_id2 = trace_id1 + 1 trace_id3 = trace_id2 + 1 scroll_end_trace_id = trace_id3 + 1 gesture_scroll_id = 87654 flow_id1 = 45678 flow_id2 = 45679 flow_id3 = 45680 trace.add_input_latency_event_slice("GestureScrollBegin", ts=ms_to_ns(0), dur=ms_to_ns(1), track=scroll_begin_trace_id, trace_id=scroll_begin_trace_id, gesture_scroll_id=gesture_scroll_id) trace.add_chrome_process_track_descriptor(process_track1, process_pid1) trace.add_chrome_thread_with_cpu_counter( process_track1, thread_track1, trusted_packet_sequence_id=seq1, counter_track=thread1_counter, pid=process_pid1, tid=thread_tid1, thread_type=trace.prototypes.ThreadDescriptor.ChromeThreadType.