rdc_field_t replaces uint32_t; centralize field data
Make the RDC use the new rdc_field_t enum instead of uint32_t.
This will help prevent invalid field types from being passed in.
Also, centralize where data related to fields is kept. This will
reduce the number of places where changes are required each
time a new field is added.
Finally, cleaned up several cpplint issues.
Change-Id: I48e4512e18c164411d8b09ae3d4bed99fba359ec
[ROCm/rdc commit: 5950ebadc4]
This commit is contained in:
@@ -23,6 +23,7 @@ THE SOFTWARE.
|
||||
#include <sstream>
|
||||
#include "rdc_lib/RdcException.h"
|
||||
#include "common/rdc_utils.h"
|
||||
#include "common/rdc_fields_supported.h"
|
||||
|
||||
namespace amd {
|
||||
namespace rdc {
|
||||
@@ -45,34 +46,6 @@ bool RdciSubSystem::is_json_output() const {
|
||||
return is_json_output_;
|
||||
}
|
||||
|
||||
bool RdciSubSystem::get_field_id_from_name(
|
||||
const std::string& name, uint32_t& value) const {
|
||||
const std::map<std::string, uint32_t> field_name_to_id = {
|
||||
{"RDC_FI_GPU_MEMORY_USAGE", 525},
|
||||
{"RDC_FI_GPU_MEMORY_TOTAL", 580},
|
||||
{"RDC_FI_POWER_USAGE", 155},
|
||||
{"RDC_FI_GPU_CLOCK", 100},
|
||||
{"RDC_FI_MEM_CLOCK", 101},
|
||||
{"RDC_FI_PCIE_TX", 200},
|
||||
{"RDC_FI_PCIE_RX", 201},
|
||||
{"RDC_FI_GPU_UTIL", 203},
|
||||
{"RDC_FI_ECC_CORRECT_TOTAL", 312},
|
||||
{"RDC_FI_ECC_UNCORRECT_TOTAL", 313},
|
||||
{"RDC_FI_MEMORY_TEMP", 140},
|
||||
{"RDC_FI_GPU_TEMP", 150},
|
||||
{"RDC_FI_GPU_COUNT", 4},
|
||||
{"RDC_FI_DEV_NAME", 50}
|
||||
};
|
||||
|
||||
auto id = field_name_to_id.find(name);
|
||||
if (id == field_name_to_id.end()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
value = id->second;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<std::string> RdciSubSystem::split_string(const std::string& s,
|
||||
char delimiter) const {
|
||||
std::vector<std::string> tokens;
|
||||
|
||||
Reference in New Issue
Block a user