| 245 | } |
| 246 | |
| 247 | static void PruneOldSwapChainData( |
| 248 | PMTraceSession const& pmSession, |
| 249 | uint64_t latestTimestamp) |
| 250 | { |
| 251 | // sometimes we arrive here after skipping all frame events in the processing loop, |
| 252 | // in which case we don't have a valid timestamp for the latest frame and should not |
| 253 | // attempt to do any pruning during this pass |
| 254 | if (latestTimestamp == 0) { |
| 255 | return; |
| 256 | } |
| 257 | |
| 258 | auto minTimestamp = latestTimestamp - pmSession.MilliSecondsDeltaToTimestamp(4000.0); |
| 259 | |
| 260 | for (auto& pair : gProcesses) { |
| 261 | auto processInfo = &pair.second; |
| 262 | |
| 263 | // Check if this is DWM process |
| 264 | const auto processNameLower = util::str::ToLower(processInfo->mModuleName); |
| 265 | const bool isDwmProcess = (processNameLower.find(L"dwm.exe") != std::wstring::npos); |
| 266 | |
| 267 | for (auto ii = processInfo->mSwapChain.begin(), ie = processInfo->mSwapChain.end(); ii != ie; ) { |
| 268 | auto swapChainAddress = ii->first; |
| 269 | auto chain = &ii->second; |
| 270 | |
| 271 | // Don't prune DWM swap chains with address 0x0 |
| 272 | bool shouldSkipPruning = isDwmProcess && swapChainAddress == 0x0; |
| 273 | bool shouldPrune = false; |
| 274 | if (!shouldSkipPruning) { |
| 275 | shouldPrune = chain->mUnifiedSwapChain.IsPrunableBefore(minTimestamp); |
| 276 | } |
| 277 | |
| 278 | if (shouldPrune) { |
| 279 | ii = processInfo->mSwapChain.erase(ii); |
| 280 | } |
| 281 | else { |
| 282 | ++ii; |
| 283 | } |
| 284 | } |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | static void QueryProcessName(uint32_t processId, ProcessInfo* info) |
| 289 | { |
no test coverage detected