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
This commit is contained in:
Chris Freehill
2020-07-24 19:40:48 -05:00
parent e6d910f67a
commit 5950ebadc4
43 changed files with 459 additions and 388 deletions
+3 -3
View File
@@ -32,7 +32,7 @@ namespace amd {
namespace rdc {
rdc_status_t RdcCacheManagerImpl::rdc_field_get_value_since(
uint32_t gpu_index, uint32_t field_id, uint64_t since_time_stamp,
uint32_t gpu_index, rdc_field_t field_id, uint64_t since_time_stamp,
uint64_t *next_since_time_stamp, rdc_field_value* value) {
if (!next_since_time_stamp || !value) {
return RDC_ST_BAD_PARAMETER;
@@ -72,7 +72,7 @@ rdc_status_t RdcCacheManagerImpl::rdc_field_get_value_since(
rdc_status_t RdcCacheManagerImpl::evict_cache(uint32_t gpu_index,
uint32_t field_id, uint64_t max_keep_samples, double max_keep_age) {
rdc_field_t field_id, uint64_t max_keep_samples, double max_keep_age) {
std::lock_guard<std::mutex> guard(cache_mutex_);
RdcFieldKey field{gpu_index, field_id};
@@ -108,7 +108,7 @@ rdc_status_t RdcCacheManagerImpl::evict_cache(uint32_t gpu_index,
}
rdc_status_t RdcCacheManagerImpl::rdc_field_get_latest_value(
uint32_t gpu_index, uint32_t field_id, rdc_field_value* value) {
uint32_t gpu_index, rdc_field_t field_id, rdc_field_value* value) {
if (!value) {
return RDC_ST_BAD_PARAMETER;
}