From 40a78109b82994070010f69350cb8344ce2fce62 Mon Sep 17 00:00:00 2001 From: markgalvan-intel Date: Mon, 9 Sep 2024 22:17:50 -0700 Subject: [PATCH] Fix for ms to secs conversion issue for gpu and cpu telemetery sampling. --- IntelPresentMon/PresentMonService/PMMainThread.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/IntelPresentMon/PresentMonService/PMMainThread.cpp b/IntelPresentMon/PresentMonService/PMMainThread.cpp index 2b31cf0b..bf7f6ba7 100644 --- a/IntelPresentMon/PresentMonService/PMMainThread.cpp +++ b/IntelPresentMon/PresentMonService/PMMainThread.cpp @@ -129,7 +129,9 @@ void PowerTelemetryThreadEntry_(Service* const srv, PresentMon* const pm, for (auto& adapter : ptc->GetPowerTelemetryAdapters()) { adapter->Sample(); } - waiter.SetInterval(pm->GetGpuTelemetryPeriod()); + // Convert from the ms to seconds as GetTelemetryPeriod returns back + // ms and SetInterval expects seconds. + waiter.SetInterval(pm->GetGpuTelemetryPeriod()/1000.); waiter.Wait(); // go dormant if there are no active streams left // TODO: consider race condition here if client stops and starts streams rapidly @@ -163,7 +165,9 @@ void CpuTelemetryThreadEntry_(Service* const srv, PresentMon* const pm, } while (WaitForSingleObject(srv->GetServiceStopHandle(), 0) != WAIT_OBJECT_0) { cpu->Sample(); - waiter.SetInterval(pm->GetGpuTelemetryPeriod()); + // Convert from the ms to seconds as GetTelemetryPeriod returns back + // ms and SetInterval expects seconds. + waiter.SetInterval(pm->GetGpuTelemetryPeriod() / 1000.); waiter.Wait(); // Get the number of currently active streams auto num_active_streams = pm->GetActiveStreams();