Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion IntelPresentMon/CommonUtilities/mc/MetricsCalculator.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2025 Intel Corporation
// Copyright (C) 2026 Intel Corporation
// SPDX-License-Identifier: MIT
#include "MetricsCalculator.h"
#include "MetricsCalculatorInternal.h"
Expand Down Expand Up @@ -119,6 +119,7 @@ namespace pmon::util::metrics
auto metrics = ComputeFrameMetrics(
qpc,
present,
chainState.lastDisplayedScreenTime,
screenTime,
nextScreenTime,
isDisplayed,
Expand Down Expand Up @@ -162,6 +163,7 @@ namespace pmon::util::metrics
auto metrics = ComputeFrameMetrics(
qpc,
present,
chainState.lastDisplayedScreenTime,
screenTime,
nextScreenTime,
isDisplayedInstance,
Expand All @@ -183,6 +185,10 @@ namespace pmon::util::metrics
const bool shouldUpdateSwapChain = (nextDisplayed != nullptr);

for (size_t displayIndex = indexing.startIndex; displayIndex < indexing.endIndex; ++displayIndex) {
const uint64_t previousDisplayedScreenTime =
displayIndex > 0
? present.displayed[displayIndex - 1].second
: chainState.lastDisplayedScreenTime;
uint64_t screenTime = present.displayed[displayIndex].second;
uint64_t nextScreenTime = 0;

Expand All @@ -207,6 +213,7 @@ namespace pmon::util::metrics
auto metrics = ComputeFrameMetrics(
qpc,
present,
previousDisplayedScreenTime,
screenTime,
nextScreenTime,
isDisplayedInstance,
Expand Down Expand Up @@ -235,6 +242,7 @@ namespace pmon::util::metrics
ComputedMetrics ComputeFrameMetrics(
const QpcConverter& qpc,
const FrameData& present,
uint64_t previousDisplayedScreenTime,
uint64_t screenTime,
uint64_t nextScreenTime,
bool isDisplayed,
Expand All @@ -258,6 +266,7 @@ namespace pmon::util::metrics
qpc,
present,
chain,
previousDisplayedScreenTime,
isDisplayed,
screenTime,
nextScreenTime,
Expand Down
3 changes: 2 additions & 1 deletion IntelPresentMon/CommonUtilities/mc/MetricsCalculator.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2025 Intel Corporation
// Copyright (C) 2026 Intel Corporation
// SPDX-License-Identifier: MIT
#pragma once
#include <cstdint>
Expand Down Expand Up @@ -50,6 +50,7 @@ namespace pmon::util::metrics
ComputedMetrics ComputeFrameMetrics(
const QpcConverter& qpc,
const FrameData& present,
uint64_t previousDisplayedScreenTime,
uint64_t screenTime,
uint64_t nextScreenTime,
bool isDisplayed,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2025 Intel Corporation
// Copyright (C) 2026 Intel Corporation
// SPDX-License-Identifier: MIT
#include "MetricsCalculator.h"
#include "MetricsCalculatorInternal.h"
Expand Down Expand Up @@ -26,12 +26,12 @@ namespace pmon::util::metrics
// Helper dedicated to computing msBetweenDisplayChange, matching legacy ReportMetricsHelper behavior.
double ComputeMsBetweenDisplayChange(
const QpcConverter& qpc,
const SwapChainCoreState& chain,
uint64_t previousDisplayedScreenTime,
bool isDisplayed,
uint64_t screenTime)
{
return isDisplayed
? qpc.DeltaUnsignedMilliSeconds(chain.lastDisplayedScreenTime, screenTime)
? qpc.DeltaUnsignedMilliSeconds(previousDisplayedScreenTime, screenTime)
: 0.0;
}

Expand Down Expand Up @@ -194,13 +194,14 @@ namespace pmon::util::metrics
const QpcConverter& qpc,
const FrameData& present,
const SwapChainCoreState& swapChain,
uint64_t previousDisplayedScreenTime,
bool isDisplayed,
uint64_t screenTime,
uint64_t nextScreenTime,
FrameMetrics& metrics)
{
metrics.msUntilDisplayed = ComputeMsUntilDisplayed(qpc, present, isDisplayed, screenTime);
metrics.msBetweenDisplayChange = ComputeMsBetweenDisplayChange(qpc, swapChain, isDisplayed, screenTime);
metrics.msBetweenDisplayChange = ComputeMsBetweenDisplayChange(qpc, previousDisplayedScreenTime, isDisplayed, screenTime);
metrics.msDisplayedTime = ComputeMsDisplayedTime(qpc, isDisplayed, screenTime, nextScreenTime);
metrics.msFlipDelay = ComputeMsFlipDelay(qpc, present, isDisplayed);
metrics.msDisplayLatency = ComputeMsDisplayLatency(qpc, swapChain, present, isDisplayed, screenTime);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2025 Intel Corporation
// Copyright (C) 2026 Intel Corporation
// SPDX-License-Identifier: MIT
#pragma once

Expand All @@ -17,6 +17,7 @@ namespace pmon::util::metrics
const QpcConverter& qpc,
const FrameData& present,
const SwapChainCoreState& swapChain,
uint64_t previousDisplayedScreenTime,
bool isDisplayed,
uint64_t screenTime,
uint64_t nextScreenTime,
Expand Down
Loading