File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed
Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -2026,7 +2026,34 @@ void PMTraceConsumer::RemoveLostPresent(std::shared_ptr<PresentEvent> p)
20262026{
20272027 VerboseTraceBeforeModifyingPresent (p.get ());
20282028 p->IsLost = true ;
2029- CompletePresent (p);
2029+
2030+ if (p->IsCompleted ) {
2031+ // Present is already completed but lost - simulate what Present_Stop would do
2032+ if (p->WaitingForPresentStop ) {
2033+ VerboseTraceBeforeModifyingPresent (p.get ());
2034+ p->WaitingForPresentStop = false ;
2035+
2036+ // Remove from thread tracking since Present_Stop won't come
2037+ auto ii = mPresentByThreadId .find (p->ThreadId );
2038+ if (ii != mPresentByThreadId .end () && ii->second == p) {
2039+ mPresentByThreadId .erase (ii);
2040+ }
2041+ if (p->DriverThreadId != 0 ) {
2042+ auto jj = mPresentByThreadId .find (p->DriverThreadId );
2043+ if (jj != mPresentByThreadId .end () && jj->second == p) {
2044+ mPresentByThreadId .erase (jj);
2045+ }
2046+ }
2047+
2048+ // Make ready for dequeue
2049+ UpdateReadyCount (true );
2050+ }
2051+ // If not waiting for Present_Stop, it should already be cleaned up properly
2052+ }
2053+ else {
2054+ // Present is not completed yet - complete it normally
2055+ CompletePresent (p);
2056+ }
20302057}
20312058
20322059void PMTraceConsumer::CompletePresent (std::shared_ptr<PresentEvent> const & p)
Original file line number Diff line number Diff line change @@ -986,6 +986,15 @@ static void ProcessEvents(
986986 // Handle any process events that occurred before this present
987987 if (checkProcessTime) {
988988 while ((*processEvents)[processEventIndex].QpcTime < presentTime) {
989+ auto & processEvent = (*processEvents)[processEventIndex];
990+
991+ // If this is a termination event for the same process as the current present,
992+ // skip processing this termination to avoid removing the process info we need
993+ if (!processEvent.IsStartEvent && processEvent.ProcessId == presentEvent->ProcessId ) {
994+ // Don't process this termination yet - we have a present from this process to handle first
995+ break ;
996+ }
997+
989998 ProcessProcessEvent ((*processEvents)[processEventIndex]);
990999 processEventIndex += 1 ;
9911000 if (processEventIndex == processEventCount) {
You can’t perform that action at this time.
0 commit comments