File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,17 @@ void FrameProfiler::processEvent(const trace_event* event) {
136136 return ;
137137 }
138138
139+ if (_mainThreadID == -1 ) {
140+ // We need the ID of the main thread to filter out multi threaded events. We just assume that the first event
141+ // of the main process we see is from the main thread. That should be a safe assumption.
142+ _mainThreadID = event->tid ;
143+ }
144+
145+ if (event->tid != _mainThreadID) {
146+ // Multithreaded events don't have a deterministic sequence and that confuses the old profiling system
147+ return ;
148+ }
149+
139150 if (event->duration == 0 ) {
140151 // Discard events with no duration
141152 return ;
Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ class FrameProfiler {
4141
4242 SCP_vector<profile_sample_history> history;
4343
44+ std::int64_t _mainThreadID = -1 ;
45+
4446 SCP_string content;
4547
4648 /* *
You can’t perform that action at this time.
0 commit comments