[SWDEV-518229] Filter N/A's from amd-smi metric clock CLI

The 'amd-smi metric --clock' was listing values with N/A. Filtered these outputs to show only available values.

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
This commit is contained in:
Kanangot Balakrishnan, Bindhiya
2025-04-28 12:28:59 -05:00
zatwierdzone przez GitHub
rodzic 4099fee17f
commit 797e4fba07
+18
Wyświetl plik
@@ -259,6 +259,24 @@ class AMDSMILogger():
for key, value in capitalized_json.items():
if key not in ["GPU", "CPU", "CORE"]:
tabbed_dictionary[key] = value
# Filter out N/A values under clock
if key == "CLOCK":
valid_clock_data = {}
if isinstance(value, dict): # Ensure value is a dictionary
for clock_key, clock_data in value.items():
if isinstance(clock_data, dict): # Ensure clock_data is a dictionary
non_na = {
clock_key: clock_value
for clock_key, clock_value in clock_data.items()
if clock_value != "N/A"
}
if non_na:
valid_clock_data[clock_key] = non_na
elif clock_data != "N/A": # Handle single-tier clock_data
valid_clock_data[clock_key] = clock_data
elif value != "N/A": # Handle non-dictionary clock data
valid_clock_data = value
tabbed_dictionary[key] = valid_clock_data
for key, value in tabbed_dictionary.items():
del capitalized_json[key]