Add rocprofiler_query_counter_info function (#452)

* Add rocprofiler_query_counter_info function

Replaces rocprofiler_query_counter_name. Allows for
querying other types of info from counters (such as
description) and gives us some flexibility to add
return data in the near future (if we have to).

* source formatting (clang-format v11) (#453)

Co-authored-by: bwelton <bwelton@users.noreply.github.com>

* Updated version fetching

* source formatting (clang-format v11) (#509)

Co-authored-by: bwelton <bwelton@users.noreply.github.com>

* Merged

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: bwelton <bwelton@users.noreply.github.com>
This commit is contained in:
Benjamin Welton
2024-02-19 16:05:38 -08:00
committed by GitHub
parent 3638351b4c
commit 7adffd5b22
9 changed files with 119 additions and 58 deletions
@@ -183,11 +183,16 @@ TEST(metrics, check_public_api_query)
const auto* id_map = counters::getMetricIdMap();
for(const auto& [id, metric] : *id_map)
{
const char* name = nullptr;
size_t size = 0;
ASSERT_EQ(rocprofiler_query_counter_name({.handle = id}, &name, &size),
ROCPROFILER_STATUS_SUCCESS);
EXPECT_EQ(std::string(name), metric.name());
EXPECT_EQ(size, metric.name().size());
rocprofiler_counter_info_v0_t version;
ASSERT_EQ(
rocprofiler_query_counter_info(
{.handle = id}, ROCPROFILER_COUNTER_INFO_VERSION_0, static_cast<void*>(&version)),
ROCPROFILER_STATUS_SUCCESS);
EXPECT_EQ(version.name, metric.name().c_str());
EXPECT_EQ(version.block, metric.block().c_str());
EXPECT_EQ(version.expression, metric.expression().c_str());
EXPECT_EQ(version.is_derived, !metric.expression().empty());
EXPECT_EQ(version.description, metric.description().c_str());
}
}