From 705a791553ea99cc814a3d1b8d989513bcac79e9 Mon Sep 17 00:00:00 2001 From: Benjamin Welton Date: Tue, 28 May 2024 15:06:54 -0700 Subject: [PATCH] Added static construct to topology (#868) * Added static construct to topology --- source/lib/rocprofiler-sdk/agent.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/lib/rocprofiler-sdk/agent.cpp b/source/lib/rocprofiler-sdk/agent.cpp index 2862ed6d3f..ced22f8ad5 100644 --- a/source/lib/rocprofiler-sdk/agent.cpp +++ b/source/lib/rocprofiler-sdk/agent.cpp @@ -355,11 +355,11 @@ read_property(const MapT& data, const std::string& label, Tp& value) } } +using unique_agent_t = std::unique_ptr; + auto read_topology() { - using unique_agent_t = std::unique_ptr; - auto sysfs_nodes_path = fs::path{"/sys/class/kfd/kfd/topology/nodes/"}; if(!fs::exists(sysfs_nodes_path)) throw std::runtime_error{ @@ -622,8 +622,9 @@ read_topology() auto& get_agent_topology() { - static auto _v = read_topology(); - return _v; + static auto*& _v = + common::static_object>::construct(read_topology()); + return *CHECK_NOTNULL(_v); } auto&