Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#pragma once
#include <string>
#include <concepts>
#include <cstddef>
#include <cstdint>
#include <format>
#include <sstream>
#include <string>
#include <type_traits>
#include "GeneratedReflection.h"

namespace pmon::util::ref::gen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ namespace pmon::util::ref::gen
const auto& s = *static_cast<const nvmlMemory_t*>(pStruct);
std::ostringstream oss;
oss << std::boolalpha << "struct nvmlMemory_t {"
<< " .free = " << s.free
<< " .total = " << s.total
<< " .free = " << s.free
<< " .used = " << s.used
<< " }";
return oss.str();
Expand Down
10 changes: 5 additions & 5 deletions IntelPresentMon/ControlLib/nvml/NvmlTelemetryProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ namespace pmon::tel::nvml
if (pMemoryInfo == nullptr) {
return (uint64_t)0;
}
return GetLegacyTotalMemoryBytes_(*pMemoryInfo);
return GetTotalMemoryBytes_(*pMemoryInfo);
}
case PM_METRIC_GPU_MEM_USED:
{
Expand All @@ -141,7 +141,7 @@ namespace pmon::tel::nvml
return 0.0;
}

const auto totalBytes = GetLegacyTotalMemoryBytes_(*pMemoryInfo);
const auto totalBytes = GetTotalMemoryBytes_(*pMemoryInfo);
if (totalBytes == 0) {
return 0.0;
}
Expand All @@ -160,9 +160,9 @@ namespace pmon::tel::nvml
(void)metricId;
}

uint64_t NvmlTelemetryProvider::GetLegacyTotalMemoryBytes_(const nvmlMemory_t& memoryInfo) noexcept
uint64_t NvmlTelemetryProvider::GetTotalMemoryBytes_(const nvmlMemory_t& memoryInfo) noexcept
{
return (uint64_t)memoryInfo.free;
return (uint64_t)memoryInfo.total;
}

bool NvmlTelemetryProvider::TryInitializeDevice_(DeviceState_& device, nvmlDevice_t handle) const
Expand Down Expand Up @@ -232,7 +232,7 @@ namespace pmon::tel::nvml
}

if (const auto* pMemoryInfo = PollMemoryInfoEndpoint_(device, requestQpc)) {
const auto totalBytes = GetLegacyTotalMemoryBytes_(*pMemoryInfo);
const auto totalBytes = GetTotalMemoryBytes_(*pMemoryInfo);
if (totalBytes != 0) {
caps.Set(PM_METRIC_GPU_MEM_SIZE, 1);
caps.Set(PM_METRIC_GPU_MEM_USED, 1);
Expand Down
2 changes: 1 addition & 1 deletion IntelPresentMon/ControlLib/nvml/NvmlTelemetryProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace pmon::tel::nvml
};

static void ValidateScalarMetricIndex_(PM_METRIC metricId, uint32_t arrayIndex);
static uint64_t GetLegacyTotalMemoryBytes_(const nvmlMemory_t& memoryInfo) noexcept;
static uint64_t GetTotalMemoryBytes_(const nvmlMemory_t& memoryInfo) noexcept;

bool TryInitializeDevice_(DeviceState_& device, nvmlDevice_t handle) const;
ipc::MetricCapabilities BuildCapsForDevice_(DeviceState_& device) const;
Expand Down
2 changes: 1 addition & 1 deletion IntelPresentMon/ControlLib/nvml/nvml.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ struct nvmlPciInfo_t {
};

struct nvmlMemory_t {
unsigned long long free;
unsigned long long total;
unsigned long long free;
unsigned long long used;
};

Expand Down