Problem
The Perfetto SDK provides legacy_sort_index field in ThreadDescriptor and ProcessDescriptor protobuf messages, but the trace processor does not parse these fields. As a result, SDK users cannot control thread/process display order in the UI when using protobuf format.
Currently, thread_sort_index_hint / process_sort_index_hint args (used by UI for sorting) can only be set through JSON trace format via thread_sort_index / process_sort_index metadata.
Use Case
In a game engine with many threads (render, audio, physics, network, etc.), developers want to pin important threads at the top of the trace view for easier analysis. For example:
auto desc = perfetto::ThreadTrack::Current().Serialize();
desc.mutable_thread()->set_thread_name("GameMainThread");
desc.mutable_thread()->set_legacy_sort_index(1); // Should appear first
perfetto::TrackEvent::SetTrackDescriptor(perfetto::ThreadTrack::Current(), desc);
Current Behavior
Setting legacy_sort_index in protobuf traces has no effect on UI ordering.
Expected Behavior
Threads/processes should be ordered by legacy_sort_index (or equivalent) in the UI, similar to how thread_sort_index works in JSON traces.
Problem
The Perfetto SDK provides
legacy_sort_indexfield inThreadDescriptorandProcessDescriptorprotobuf messages, but the trace processor does not parse these fields. As a result, SDK users cannot control thread/process display order in the UI when using protobuf format.Currently,
thread_sort_index_hint/process_sort_index_hintargs (used by UI for sorting) can only be set through JSON trace format viathread_sort_index/process_sort_indexmetadata.Use Case
In a game engine with many threads (render, audio, physics, network, etc.), developers want to pin important threads at the top of the trace view for easier analysis. For example:
Current Behavior
Setting
legacy_sort_indexin protobuf traces has no effect on UI ordering.Expected Behavior
Threads/processes should be ordered by
legacy_sort_index(or equivalent) in the UI, similar to howthread_sort_indexworks in JSON traces.