Add support to use the field name in rdci

In the rdci dmon and fieldgroup, now the fields can be specified
using either number id or the field name.

When the rdc is async fetching metrics, it will not report that fetch
as an error.

Change-Id: I81331e2c239af987181147be5ac0e29ba1617ab4


[ROCm/rdc commit: d30cb81fdb]
This commit is contained in:
Bill(Shuzhou) Liu authored and Chris Freehill committed 2020-08-17 14:07:25 -05:00
1 bovenliggende aa0a40f84d
commit 0f8f345992
6 files changed
+60 -12

No files matched your search

@@ -147,10 +147,15 @@ void RdciDmonSubSystem::parse_cmd_opts(int argc, char ** argv) {
std::vector<std::string> vec_ids = split_string(field_ids, ',');
for (uint32_t i = 0; i < vec_ids.size(); i++) {
if (!IsNumber(vec_ids[i])) {
throw RdcException(RDC_ST_BAD_PARAMETER, "The field Id "
+vec_ids[i]+" needs to be a number");
uint32_t field_id = 0;
if (!get_field_id_from_name(vec_ids[i], field_id)) {
throw RdcException(RDC_ST_BAD_PARAMETER,
"The field name "+vec_ids[i]+" is not valid");
}
field_ids_.push_back(field_id);
} else {
field_ids_.push_back(std::stoi(vec_ids[i]));
}
field_ids_.push_back(std::stoi(vec_ids[i]));
}
}
}