Add rsmi_dev_memory_busy_percent_get()

Change-Id: Ide683b6c72870af547331f4502c5bb8c445d61b5


[ROCm/amdsmi commit: 1c5e090507]
This commit is contained in:
Chris Freehill
2019-06-25 14:21:34 -05:00
parent 1ce6397e6b
commit c2930981ee
9 changed files with 60 additions and 7 deletions
@@ -56,7 +56,7 @@
TestMemUtilRead::TestMemUtilRead() : TestBase() {
set_title("Memory Utilization Read Test");
set_description("The Memory Utilization Read tests verifies that "
"memory utilization can be read properly.");
"memory busy percent, size and amount used can be read properly.");
}
TestMemUtilRead::~TestMemUtilRead(void) {
@@ -94,6 +94,7 @@ void TestMemUtilRead::Run(void) {
rsmi_status_t err;
uint64_t total;
uint64_t usage;
uint32_t mem_busy_percent;
TestBase::Run();
@@ -113,6 +114,17 @@ void TestMemUtilRead::Run(void) {
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(i);
#if 0
err = rsmi_dev_memory_busy_percent_get(i, &mem_busy_percent);
err_chk("rsmi_dev_memory_busy_percent_get()");
if (err != RSMI_STATUS_SUCCESS) {
return;
}
IF_VERB(STANDARD) {
std::cout << "\t**" << "GPU Memory Busy %: " << mem_busy_percent <<
std::endl;
}
#endif
for (uint32_t mem_type = RSMI_MEM_TYPE_FIRST;
mem_type <= RSMI_MEM_TYPE_LAST; ++mem_type) {
err = rsmi_dev_memory_total_get(i,
@@ -132,8 +144,8 @@ void TestMemUtilRead::Run(void) {
IF_VERB(STANDARD) {
std::cout << "\t**" <<
kDevMemoryTypeNameMap.at(static_cast<rsmi_memory_type_t>(mem_type)) <<
" Utilization: " << (static_cast<float>(usage)*100)/total << "% ("<<
usage << "/" << total << ")" << std::endl;
" Calculated Utilization: " << (static_cast<float>(usage)*100)/total
<< "% ("<< usage << "/" << total << ")" << std::endl;
}
}
}
+1 -1
View File
@@ -199,7 +199,7 @@ TEST(rsmitstReadOnly, TestIdInfoRead) {
TestIdInfoRead tst;
RunGenericTest(&tst);
}
TEST(rsmitstreadWrite,TestPerfCntrReadWrite) {
TEST(rsmitstreadWrite, TestPerfCntrReadWrite) {
TestPerfCntrReadWrite tst;
RunGenericTest(&tst);
}
@@ -115,7 +115,7 @@ class TestBase {
std::string title_; ///< Displayed title of test
uint32_t verbosity_; ///< How much additional output to produce
bool dont_fail_; ///< Don't quit test on individual failure if true
uint64_t init_options_; ///< rsmi initialization options
uint64_t init_options_; ///< rsmi initialization options
};
#define IF_VERB(VB) if (verbosity() && verbosity() >= (TestBase::VERBOSE_##VB))
@@ -72,8 +72,8 @@ static const char * kRasErrStateStrings[] = {
"Poison" // RSMI_RAS_ERR_STATE_POISON
};
static_assert(
sizeof(kRasErrStateStrings)/sizeof(char *) == (RSMI_RAS_ERR_STATE_LAST + 1),
"kErrStateNameMap needs to be updated");
sizeof(kRasErrStateStrings)/sizeof(char *) == (RSMI_RAS_ERR_STATE_LAST + 1),
"kErrStateNameMap needs to be updated");
static const std::map<rsmi_ras_err_state_t, const char *> kErrStateNameMap = {