Migrate XML counter defs and reader from v1/v2 (#25)
* Migrate XML counter defs and reader from v1/v2
* working set
* more fixes
* Update CMakeLists.txt
* source formatting (clang-format v11) (#83)
Co-authored-by: bwelton <bwelton@users.noreply.github.com>
* Update source/lib/rocprofiler/counters/CMakeLists.txt
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: bwelton <bwelton@users.noreply.github.com>
Co-authored-by: Jonathan R. Madsen <jrmadsen@users.noreply.github.com>
[ROCm/rocprofiler-sdk commit: 59cc2a382c]
This commit is contained in:
committed by
GitHub
orang tua
d98973ffb5
melakukan
b66bcdd107
@@ -0,0 +1,42 @@
|
||||
#include "metrics_test.h"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "lib/rocprofiler/counters/metrics.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
auto
|
||||
loadTestData(std::unordered_map<std::string, std::vector<std::vector<std::string>>> map)
|
||||
{
|
||||
std::unordered_map<std::string, std::vector<counters::Metric>> ret;
|
||||
for(auto& [gfx, dataMap] : map)
|
||||
{
|
||||
auto& metric_vec = ret.emplace(gfx, std::vector<counters::Metric>{}).first->second;
|
||||
for(auto& data_vec : dataMap)
|
||||
{
|
||||
metric_vec.emplace_back(
|
||||
data_vec.at(0), data_vec.at(1), data_vec.at(2), data_vec.at(4), data_vec.at(3));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
TEST(MetricsTest, BaseMetricLoad)
|
||||
{
|
||||
auto x = counters::getBaseHardwareMetrics();
|
||||
auto test_data = loadTestData(basic_gfx908);
|
||||
ASSERT_EQ(x.count("gfx908"), 1);
|
||||
ASSERT_EQ(test_data.count("gfx908"), 1);
|
||||
EXPECT_EQ(fmt::format("{}", x["gfx908"]), fmt::format("{}", test_data["gfx908"]));
|
||||
}
|
||||
|
||||
TEST(MetricsTest, DerrivedMetricLoad)
|
||||
{
|
||||
auto x = counters::getDerrivedHardwareMetrics();
|
||||
auto test_data = loadTestData(derrived_gfx908);
|
||||
ASSERT_EQ(x.count("gfx908"), 1);
|
||||
ASSERT_EQ(test_data.count("gfx908"), 1);
|
||||
EXPECT_EQ(fmt::format("{}", x["gfx908"]), fmt::format("{}", test_data["gfx908"]));
|
||||
}
|
||||
Reference in New Issue
Block a user