MCPcopy Create free account
hub / github.com/GameTechDev/PresentMon / StopTrackingPresent

Method StopTrackingPresent

PresentData/PresentMonTraceConsumer.cpp:1932–2048  ·  view source on GitHub ↗

Remove the present from all temporary tracking structures.

Source from the content-addressed store, hash-verified

1930
1931// Remove the present from all temporary tracking structures.
1932void PMTraceConsumer::StopTrackingPresent(std::shared_ptr<PresentEvent> const& p)
1933{
1934 // Don't report changes to the tracking members.
1935 VerboseTraceBeforeModifyingPresent(nullptr);
1936
1937 // mTrackedPresents
1938 if (p->RingIndex != UINT32_MAX) {
1939 mTrackedPresents[p->RingIndex] = nullptr;
1940 p->RingIndex = UINT32_MAX;
1941 }
1942
1943 // mPresentByThreadId
1944 //
1945 // If the present was batched, it will by referenced in mPresentByThreadId
1946 // by both ThreadId and DriverThreadId.
1947 //
1948 // We don't reset ThreadId nor DriverThreadId as both are useful outside of
1949 // tracking.
1950 if (!p->WaitingForPresentStop) {
1951 auto ii = mPresentByThreadId.find(p->ThreadId);
1952 if (ii != mPresentByThreadId.end() && ii->second == p) {
1953 mPresentByThreadId.erase(ii);
1954 }
1955 }
1956 if (p->DriverThreadId != 0) {
1957 auto ii = mPresentByThreadId.find(p->DriverThreadId);
1958 if (ii != mPresentByThreadId.end() && ii->second == p) {
1959 mPresentByThreadId.erase(ii);
1960 }
1961 }
1962
1963 // mOrderedPresentsByProcessId
1964 mOrderedPresentsByProcessId[p->ProcessId].erase(p->PresentStartTime);
1965
1966 // mPresentBySubmitSequence
1967 RemovePresentFromSubmitSequenceIdTracking(p);
1968
1969 // mPresentByWin32KPresentHistoryToken
1970 if (p->CompositionSurfaceLuid != 0) {
1971 Win32KPresentHistoryToken key(
1972 p->CompositionSurfaceLuid,
1973 p->Win32KPresentCount,
1974 p->Win32KBindId
1975 );
1976
1977 auto eventIter = mPresentByWin32KPresentHistoryToken.find(key);
1978 if (eventIter != mPresentByWin32KPresentHistoryToken.end() && (eventIter->second == p)) {
1979 mPresentByWin32KPresentHistoryToken.erase(eventIter);
1980 }
1981
1982 p->CompositionSurfaceLuid = 0;
1983 p->Win32KPresentCount = 0;
1984 p->Win32KBindId = 0;
1985 }
1986
1987 // mPresentByDxgkPresentHistoryToken
1988 if (p->DxgkPresentHistoryToken != 0) {
1989 auto eventIter = mPresentByDxgkPresentHistoryToken.find(p->DxgkPresentHistoryToken);

Callers

nothing calls this directly

Calls 2

endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected