rocrtst: Add new test for querying Clock Counters
added new subtest to Agent Properties test, to check functionality of query. Signed-off-by: Sunday Clement <Sunday.Clement@amd.com>
This commit is contained in:
gecommit door
Clement, Sunday
bovenliggende
e97d06530e
commit
d2b35dfee6
@@ -161,9 +161,32 @@ void AgentPropTest::QueryAgentProp(hsa_agent_t agent,
|
||||
propList_.push_back(ss.str());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
FAIL();
|
||||
case HSA_AMD_AGENT_INFO_CLOCK_COUNTERS: {
|
||||
std::stringstream str_s;
|
||||
|
||||
hsa_amd_clock_counters_t counters = {0};
|
||||
|
||||
err = hsa_agent_get_info(agent, prop, &counters);
|
||||
ASSERT_EQ(err, HSA_STATUS_SUCCESS);
|
||||
|
||||
str_s << "\n\n Clock Counters";
|
||||
str_s << "\n Clock Frequency: " << counters.system_clock_frequency << "\n";
|
||||
str_s << " GPU Clock counter: " << counters.gpu_clock_counter << "\n";
|
||||
str_s << " System system_clock_counter: " << counters.system_clock_counter << "\n";
|
||||
str_s << " CPU Clock counter: " << counters.cpu_clock_counter << "\n";
|
||||
propList_.push_back(str_s.str());
|
||||
|
||||
ASSERT_NE(0, counters.system_clock_frequency);
|
||||
ASSERT_NE(0, counters.gpu_clock_counter);
|
||||
ASSERT_NE(0, counters.system_clock_counter);
|
||||
ASSERT_NE(0, counters.cpu_clock_counter);
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
FAIL();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void AgentPropTest::QueryAgentUUID() {
|
||||
@@ -195,4 +218,24 @@ void AgentPropTest::QueryAgentUUID() {
|
||||
}
|
||||
}
|
||||
|
||||
void AgentPropTest::QueryAgentClockCounters() {
|
||||
hsa_status_t err;
|
||||
if (verbosity() > 0) {
|
||||
PrintAgentPropsSubtestHeader("Query Agent's Clock Counters");
|
||||
}
|
||||
|
||||
// find all gpu agents
|
||||
std::vector<hsa_agent_t> gpus;
|
||||
err = hsa_iterate_agents(rocrtst::IterateGPUAgents, &gpus);
|
||||
ASSERT_EQ(err, HSA_STATUS_SUCCESS);
|
||||
|
||||
for (uint32_t idx = 0 ; idx < gpus.size(); ++idx) {
|
||||
QueryAgentProp(gpus[idx], (hsa_agent_info_t)HSA_AMD_AGENT_INFO_CLOCK_COUNTERS);
|
||||
}
|
||||
|
||||
if (verbosity() > 0) {
|
||||
std::cout << " *** Execution completed - subtest Passed " << " ***" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
#undef RET_IF_HSA_ERR
|
||||
|
||||
@@ -77,6 +77,9 @@ class AgentPropTest : public TestBase {
|
||||
// @Brief: Query UUID property of agents of a ROCm platform
|
||||
void QueryAgentUUID();
|
||||
|
||||
// @Brief: Query Clock Counter property of agents of a ROCm platform
|
||||
void QueryAgentClockCounters();
|
||||
|
||||
private:
|
||||
// Capture value for all agents on system
|
||||
std::vector<std::string> propList_;
|
||||
|
||||
@@ -374,10 +374,11 @@ TEST(rocrtstFunc, Deallocation_Notifier_Test) {
|
||||
RunGenericTest(¬ifier);
|
||||
}
|
||||
|
||||
TEST(rocrtstFunc, AgentProp_UUID) {
|
||||
TEST(rocrtstFunc, AgentPropertiesTests) {
|
||||
AgentPropTest propTest;
|
||||
RunCustomTestProlog(&propTest);
|
||||
propTest.QueryAgentUUID();
|
||||
propTest.QueryAgentClockCounters();
|
||||
RunCustomTestEpilog(&propTest);
|
||||
}
|
||||
|
||||
|
||||
Verwijs in nieuw issue
Block a user