Skip to content

Commit ae1ea2e

Browse files
committed
improving middleware diagnostics
1 parent a891ae0 commit ae1ea2e

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

IntelPresentMon/PresentMonMiddleware/ConcreteMiddleware.cpp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -368,30 +368,26 @@ namespace pmon::mid
368368
std::optional<uint32_t> cachedGpuInfoIndex;
369369

370370
uint64_t offset = 0u;
371-
for (auto& qe : queryElements)
372-
{
371+
for (auto& qe : queryElements) {
373372
// A device of zero is NOT a graphics adapter.
374-
if (qe.deviceId != 0)
375-
{
373+
if (qe.deviceId != 0) {
376374
// If we have already set a device id in this query, check to
377375
// see if it's the same device id as previously set. Currently
378376
// we don't support querying multiple gpu devices in the one
379377
// query
380-
if (cachedGpuInfoIndex.has_value())
381-
{
382-
if (cachedGpuInfo[cachedGpuInfoIndex.value()].deviceId != qe.deviceId)
383-
{
384-
throw std::runtime_error{ "Multiple GPU devices not allowed in single query" };
378+
if (cachedGpuInfoIndex.has_value()) {
379+
const auto cachedDeviceId = cachedGpuInfo[cachedGpuInfoIndex.value()].deviceId;
380+
if (cachedDeviceId != qe.deviceId) {
381+
pmlog_error(std::format(L"Multiple GPU devices not allowed in single query ({} and {})",
382+
cachedDeviceId, qe.deviceId)).diag();
383+
throw Except<util::Exception>("Multiple GPU devices not allowed in single query");
385384
}
386385
}
387-
else
388-
{
386+
else {
389387
// Go through the cached Gpus and see which device the client
390388
// wants
391-
for (int i = 0; i < cachedGpuInfo.size(); i++)
392-
{
393-
if (qe.deviceId == cachedGpuInfo[i].deviceId)
394-
{
389+
for (int i = 0; i < cachedGpuInfo.size(); i++) {
390+
if (qe.deviceId == cachedGpuInfo[i].deviceId) {
395391
cachedGpuInfoIndex = i;
396392
break;
397393
}
@@ -543,8 +539,10 @@ namespace pmon::mid
543539
//pQuery->accumCpuBits.set(static_cast<size_t>(CpuTelemetryCapBits::cpu_power));
544540
break;
545541
default:
546-
pmlog_warn(std::format(L"ignoring invalid metric [{}] while building dynamic query",
547-
str::ToWide(metricView.Introspect().GetSymbol()))).diag();
542+
if (metricView.GetType() == PM_METRIC_TYPE_FRAME_EVENT) {
543+
pmlog_warn(std::format(L"ignoring frame event metric [{}] while building dynamic query",
544+
str::ToWide(metricView.Introspect().GetSymbol()))).diag();
545+
}
548546
break;
549547
}
550548

0 commit comments

Comments
 (0)