Python - Add entitycodec

Change-Id: I9dc7f5786e2c5ee5f9756cad7cb12387d05982ae
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
This commit is contained in:
Galantsev, Dmitrii
2025-06-11 12:07:53 -05:00
committed by Galantsev, Dmitrii
parent 502fcef7b3
commit cae49cf4f7
3 changed files with 18 additions and 15 deletions
-13
View File
@@ -27,14 +27,6 @@ default_unit_coverter = {
rdc_field_t.RDC_FI_GPU_TEMP: 0.001, # degree
}
class rdc_entity_info_t(Structure):
_fields_ = [
("device_type", c_uint32),
("entity_role", c_uint32),
("instance_index", c_uint32),
("device_index", c_uint32),
]
class RdcReader:
# To run the RDC in embedded mode, set the ip_port = None
def __init__(self, ip_port = "localhost:50051", field_ids = default_field_ids,
@@ -53,11 +45,6 @@ class RdcReader:
self.unit_converter = unit_converter
self.rdc_handle = c_void_p()
rdc.rdc_get_entity_index_from_info.argtypes = [rdc_entity_info_t]
rdc.rdc_get_entity_index_from_info.restype = c_uint32
rdc.rdc_get_info_from_entity_index.argtypes = [c_uint32]
rdc.rdc_get_info_from_entity_index.restype = rdc_entity_info_t
self.is_standalone = True
if not ip_port: # embedded
self.is_standalone = False
+13
View File
@@ -381,6 +381,15 @@ class rdc_job_group_info_t(Structure):
,("stop_time", c_uint64)
]
class rdc_entity_info_t(Structure):
_fields_ = [
("device_index", c_uint32),
("instance_index", c_uint32),
("entity_role", c_uint32),
("device_type", c_uint32),
]
rdc.rdc_init.restype = rdc_status_t
rdc.rdc_init.argtypes = [ c_uint64 ]
rdc.rdc_shutdown.restype = rdc_status_t
@@ -441,3 +450,7 @@ rdc.field_id_string.restype = c_char_p
rdc.field_id_string.argtypes = [ rdc_field_t ]
rdc.get_field_id_from_name.restype = rdc_field_t
rdc.get_field_id_from_name.argtypes = [ c_char_p ]
rdc.rdc_get_entity_index_from_info.argtypes = [ rdc_entity_info_t ]
rdc.rdc_get_entity_index_from_info.restype = c_uint32
rdc.rdc_get_info_from_entity_index.argtypes = [c_uint32]
rdc.rdc_get_info_from_entity_index.restype = rdc_entity_info_t
+5 -2
View File
@@ -6,13 +6,16 @@ set(SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(INC_DIR "${PROJECT_SOURCE_DIR}/include/rdc_modules/rdc_rocp")
set(RDC_ROCP_LIB_COMPONENT "lib${RDC_ROCP_LIB}")
set(RDC_ROCP_LIB_SRC_LIST "${BOOTSTRAP_LIB_SRC_DIR}/RdcLogger.cc" "${SRC_DIR}/RdcTelemetryLib.cc"
"${SRC_DIR}/RdcRocpCounterSampler.cc" "${SRC_DIR}/RdcRocpBase.cc")
set(RDC_ROCP_LIB_SRC_LIST
"${BOOTSTRAP_LIB_SRC_DIR}/RdcLogger.cc" "${BOOTSTRAP_LIB_SRC_DIR}/RdcEntityCodec.cc"
"${SRC_DIR}/RdcTelemetryLib.cc" "${SRC_DIR}/RdcRocpCounterSampler.cc"
"${SRC_DIR}/RdcRocpBase.cc")
set(RDC_ROCP_LIB_INC_LIST
"${PROJECT_SOURCE_DIR}/include/rdc/rdc.h"
"${RDC_LIB_INC_DIR}/RdcDiagnosticLibInterface.h"
"${RDC_LIB_INC_DIR}/rdc_common.h"
"${RDC_LIB_INC_DIR}/RdcLogger.h"
"${RDC_LIB_INC_DIR}/RdcEntityCodec.h"
"${SRC_DIR}/../../rdc/src/SmiUtils.cc"
"${INC_DIR}/RdcRocpBase.h"
"${INC_DIR}/RdcRocpCounterSampler.h")