fix(tools): sort trace presents by timestamp only

Trace.presents holds (ts, args.present) pairs and was sorted as whole tuples.
Two present events with the same timestamp, one with a present number and one
without, made the sort compare None with an int and raised an uncaught
TypeError, so trace_digest exited with a traceback instead of a digest. The
sort now keys on the timestamp; it is stable, so tied events keep the order of
the trace.
This commit is contained in:
MarcZX10 committed 2026-10-28 03:13:51 +00:00
1 parent 3ca715ee15
commit d27e90bb8a
1 file changed
+1 -1
+1 -1
View File
@@ -98,7 +98,7 @@ class Trace:
elif phase == "C":
tid = _event_tid(event, index)
self.folded[tid] += sum(_event_value(value, "args value", index) for value in _event_args(event, index).values())
self.presents.sort()
self.presents.sort(key=lambda present: present[0])
for slices in self.slices.values():
slices.sort(key=lambda entry: (entry[0], -entry[1]))
stack = []