Skip to content

Commit 1e28155

Browse files
committed
Timeline: Fix queue time correction
1 parent bf9ac8c commit 1e28155

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lglpy/timeline/data/raw_trace.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -878,19 +878,22 @@ def load_perfetto_from_file(
878878
# Sort events into time order
879879
trace_events.sort(key=lambda x: x.start_time)
880880

881-
# Replace time so first event starts at time = 0
881+
# Replace time so first event starts at time = 0 and that queued time
882+
# waiting for earlier work does not show as running
882883
streams = {}
883884
start_time = trace_events[0].start_time
884885
for event in trace_events:
885886
event.start_time -= start_time
886887

887-
# Also ensure that queued time does not show as running
888+
# First job in stream so just add to stream
888889
if event.stream not in streams:
889890
streams[event.stream] = [event]
890891
continue
891892

893+
# Later job in stream so remove any overlap with job N-1
892894
last_event = streams[event.stream][-1]
893895
last_event_end = last_event.start_time + last_event.duration
896+
streams[event.stream].append(event)
894897

895898
# Remove overlap if queued while last event still running
896899
if event.start_time <= last_event_end:

0 commit comments

Comments
 (0)