Use static_object for dimension map (#616)

[ROCm/rocprofiler-sdk commit: a06eef3488]
This commit is contained in:
Benjamin Welton
2024-03-13 07:28:33 -07:00
committad av GitHub
förälder 043db3b3a4
incheckning da708a2651
2 ändrade filer med 8 tillägg och 5 borttagningar
@@ -34,10 +34,10 @@ namespace rocprofiler
{
namespace counters
{
const std::unordered_map<rocprofiler_profile_counter_instance_types, std::string_view>&
const DimensionMap&
dimension_map()
{
static std::unordered_map<rocprofiler_profile_counter_instance_types, std::string_view> map = {
static auto*& _v = common::static_object<DimensionMap>::construct(DimensionMap{
{ROCPROFILER_DIMENSION_NONE, std::string_view("DIMENSION_NONE")},
{ROCPROFILER_DIMENSION_XCC, std::string_view("DIMENSION_XCC")},
{ROCPROFILER_DIMENSION_SHADER_ENGINE, std::string_view("DIMENSION_SHADER_ENGINE")},
@@ -45,8 +45,8 @@ dimension_map()
{ROCPROFILER_DIMENSION_SHADER_ARRAY, std::string_view("DIMENSION_SHADER_ARRAY")},
{ROCPROFILER_DIMENSION_CU, std::string_view("DIMENSION_CU")},
{ROCPROFILER_DIMENSION_INSTANCE, std::string_view("DIMENSION_INSTANCE")},
};
return map;
});
return *_v;
}
const std::unordered_map<int, rocprofiler_profile_counter_instance_types>&
@@ -48,7 +48,10 @@ enum rocprofiler_profile_counter_instance_types
ROCPROFILER_DIMENSION_LAST
};
const std::unordered_map<rocprofiler_profile_counter_instance_types, std::string_view>&
using DimensionMap =
std::unordered_map<rocprofiler_profile_counter_instance_types, std::string_view>;
const DimensionMap&
dimension_map();
inline rocprofiler_counter_id_t