Skip to content

Commit 615bf7c

Browse files
Updated the NVIDIA changes to correctly handle using NVML API call. Updated FPS calculations to use frame times when calculating all stats and then converting to FPS at the end. Produces more accurate results. Added an additional application to TargetBlockList.
1 parent 65d79b8 commit 615bf7c

File tree

4 files changed

+40
-6
lines changed

4 files changed

+40
-6
lines changed

IntelPresentMon/AppCef/Web/BlockLists/TargetBlockList.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ wsl2distromanager.exe
297297
wudfhost.exe
298298
wwahost.exe
299299
xboxgamebarwidgets.exe
300+
xboxgamebarspotify.exe
300301
xboxapp.exe
301302
xboxpcapp.exe
302303
xdesproc.exe

IntelPresentMon/ControlLib/NvidiaPowerTelemetryAdapter.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ namespace pwr::nv
6868
for (const auto& sensor : thermals.sensor)
6969
{
7070
// TODO: consider prioritizing sensor.controller == NVAPI_THERMAL_CONTROLLER_GPU_INTERNAL when multiple GPU thermals are present
71-
if (sensor.target == NVAPI_THERMAL_TARGET_GPU)
72-
{
71+
if ((sensor.target == NVAPI_THERMAL_TARGET_GPU) &&
72+
(sensor.controller == NVAPI_THERMAL_CONTROLLER_GPU_INTERNAL)) {
7373
info.gpu_temperature_c = (double)sensor.currentTemp;
7474
SetTelemetryCapBit(GpuTelemetryCapBits::gpu_temperature);
7575
}
@@ -175,13 +175,15 @@ namespace pwr::nv
175175
}
176176

177177
{// temperature
178-
if (!GetPowerTelemetryCapBits().test(static_cast<size_t>(GpuTelemetryCapBits::gpu_temperature)))
178+
if (!GetPowerTelemetryCapBits().test(static_cast<size_t>(GpuTelemetryCapBits::gpu_temperature))||
179+
(useNvmlTemperature))
179180
{
180181
unsigned int temp = 0;
181182
if (nvml->Ok(nvml->DeviceGetTemperature(*hNvml, nvmlTemperatureSensors_t::NVML_TEMPERATURE_GPU, &temp)))
182183
{
183184
info.gpu_temperature_c = (double)temp;
184185
SetTelemetryCapBit(GpuTelemetryCapBits::gpu_temperature);
186+
useNvmlTemperature = true;
185187
}
186188
// TODO: consider logging failure (lower logging level perhaps)
187189
}

IntelPresentMon/ControlLib/NvidiaPowerTelemetryAdapter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@ namespace pwr::nv
3535
std::string name = "Unknown Adapter Name";
3636
mutable std::mutex historyMutex;
3737
TelemetryHistory<PresentMonPowerTelemetryInfo> history{ PowerTelemetryAdapter::defaultHistorySize };
38+
bool useNvmlTemperature = false;
3839
};
3940
}

IntelPresentMon/PresentMonMiddleware/source/ConcreteMiddleware.cpp

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,11 +1043,41 @@ void ReportMetrics(
10431043

10441044
case PM_METRIC_PRESENTED_FPS:
10451045
{
1046-
std::vector<double> cpu_fps(swapChain.CPUDuration.size());
1046+
std::vector<double> frameTimes(swapChain.CPUDuration.size());
10471047
for (size_t i = 0; i < swapChain.CPUDuration.size(); ++i) {
1048-
cpu_fps[i] = 1000.0 / (swapChain.CPUDuration[i] + swapChain.CPUFramePacingStall[i]);
1048+
frameTimes[i] = swapChain.CPUDuration[i] + swapChain.CPUFramePacingStall[i];
10491049
}
1050-
CalculateMetric(output, cpu_fps, element.stat);
1050+
switch (element.stat)
1051+
{
1052+
case PM_STAT_PERCENTILE_99:
1053+
CalculateMetric(output, frameTimes, PM_STAT_PERCENTILE_01);
1054+
break;
1055+
case PM_STAT_PERCENTILE_95:
1056+
CalculateMetric(output, frameTimes, PM_STAT_PERCENTILE_05);
1057+
break;
1058+
case PM_STAT_PERCENTILE_90:
1059+
CalculateMetric(output, frameTimes, PM_STAT_PERCENTILE_10);
1060+
break;
1061+
case PM_STAT_PERCENTILE_10:
1062+
CalculateMetric(output, frameTimes, PM_STAT_PERCENTILE_90);
1063+
break;
1064+
case PM_STAT_PERCENTILE_05:
1065+
CalculateMetric(output, frameTimes, PM_STAT_PERCENTILE_95);
1066+
break;
1067+
case PM_STAT_PERCENTILE_01:
1068+
CalculateMetric(output, frameTimes, PM_STAT_PERCENTILE_99);
1069+
break;
1070+
case PM_STAT_MAX:
1071+
CalculateMetric(output, frameTimes, PM_STAT_MIN);
1072+
break;
1073+
case PM_STAT_MIN:
1074+
CalculateMetric(output, frameTimes, PM_STAT_MAX);
1075+
break;
1076+
default:
1077+
CalculateMetric(output, frameTimes, element.stat);
1078+
}
1079+
// Convert to FPS
1080+
output = 1000.0 / output;
10511081
}
10521082
break;
10531083
case PM_METRIC_DISPLAYED_FPS:

0 commit comments

Comments
 (0)