From c3ed6ffbfe1bd4021852655d7968d4adbe822af6 Mon Sep 17 00:00:00 2001 From: Deepak Mewar Date: Thu, 1 Feb 2024 04:59:33 -0500 Subject: [PATCH] Updated python interface for metric table readable timestamp Change-Id: I251d9ee9c908413e29dd4ce6bf46acb448867a43 [ROCm/amdsmi commit: 8adf3eba1b475ac2ee5881d52457c71230ee5955] --- projects/amdsmi/py-interface/amdsmi_interface.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/amdsmi/py-interface/amdsmi_interface.py b/projects/amdsmi/py-interface/amdsmi_interface.py index ef2e21089f..4fa456b0ab 100644 --- a/projects/amdsmi/py-interface/amdsmi_interface.py +++ b/projects/amdsmi/py-interface/amdsmi_interface.py @@ -29,6 +29,7 @@ from . import amdsmi_wrapper from .amdsmi_exception import * import sys import math +from time import localtime, asctime, time MAX_NUM_PROCESSES = 1024 @@ -1413,6 +1414,10 @@ def amdsmi_get_metrics_table( ) ) + rawtime = int(mtbl.timestamp) + rawtime = time() + timeinfo = localtime(rawtime) + return { "mtbl_accumulation_counter": mtbl.accumulation_counter, "mtbl_max_socket_temperature": f"{round(check_msb_32(mtbl.max_socket_temperature) * fraction_q10 ,3)} °C", @@ -1425,6 +1430,7 @@ def amdsmi_get_metrics_table( "mtbl_max_socket_power_limit": f"{round(mtbl.max_socket_power_limit * fraction_uq10 ,3)} W", "mtbl_socket_power": f"{round(mtbl.socket_power * fraction_uq10 ,3)} W", "mtbl_timestamp_raw": mtbl.timestamp, + "mtbl_timestamp_readable": f"{asctime(timeinfo)}", "mtbl_socket_energy_acc": f"{round((mtbl.socket_energy_acc * fraction_uq16)/KILO ,3)} kJ", "mtbl_ccd_energy_acc": f"{round((mtbl.ccd_energy_acc * fraction_uq16)/KILO ,3)} kJ", "mtbl_xcd_energy_acc": f"{round((mtbl.xcd_energy_acc * fraction_uq16)/KILO ,3)} kJ",