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

Method Consume

IntelPresentMon/PresentMonMiddleware/FrameMetricsSource.cpp:248–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246 }
247
248 std::vector<util::metrics::FrameMetrics> FrameMetricsSource::Consume(size_t maxFrames)
249 {
250 std::vector<util::metrics::FrameMetrics> output;
251 Update();
252
253 if (maxFrames == 0) {
254 return output;
255 }
256
257 output.reserve(maxFrames);
258
259 for (size_t i = 0; i < maxFrames; ++i) {
260 SwapChainState* selectedState = nullptr;
261 const util::metrics::FrameMetrics* selectedMetrics = nullptr;
262 uint64_t selectedSwapChain = 0;
263
264 for (auto& [address, state] : swapChains_) {
265 if (!state.HasPending()) {
266 continue;
267 }
268 const auto& metrics = state.Peek();
269 if (selectedMetrics == nullptr ||
270 metrics.timeInSeconds < selectedMetrics->timeInSeconds ||
271 (metrics.timeInSeconds == selectedMetrics->timeInSeconds && address < selectedSwapChain)) {
272 selectedMetrics = &metrics;
273 selectedState = &state;
274 selectedSwapChain = address;
275 }
276 }
277
278 if (selectedMetrics == nullptr || selectedState == nullptr) {
279 break;
280 }
281
282 output.push_back(*selectedMetrics);
283 selectedState->ConsumeNext();
284 }
285
286 return output;
287 }
288
289 void FrameMetricsSource::Flush()
290 {

Callers 1

ConsumeFrameEventsMethod · 0.45

Calls 4

HasPendingMethod · 0.80
PeekMethod · 0.80
push_backMethod · 0.80
ConsumeNextMethod · 0.80

Tested by

no test coverage detected