From be4e0c7f7d69933527b542894a23e23d05a4ea84 Mon Sep 17 00:00:00 2001 From: Vishal Patel Date: Wed, 23 Oct 2024 10:24:42 -0700 Subject: [PATCH] Fix check for PL SysMon The temperature reading is -280226 when PL SysMon is not available so check for this value. --- src/xlnx_platformstats.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/xlnx_platformstats.c b/src/xlnx_platformstats.c index 41a6889..97dabb2 100644 --- a/src/xlnx_platformstats.c +++ b/src/xlnx_platformstats.c @@ -19,6 +19,7 @@ #include "utils.h" #define MAX_FILENAME_LEN 500 +#define INVALID_PL_TEMP -280226 // Temp reported by hwmon when PL SysMon not available FILE *fp_out; @@ -1135,11 +1136,11 @@ int print_sysmon_power_info(int verbose_flag, int sample_interval, int sample_wi fprintf(fp_out, "VTT PS GTR voltage : %ld mV\t\t %ld mV\n\n",VTT_PS_GTR,VTT_PS_GTR_avg); fprintf(fp_out, "PL Sysmon\n"); - if (PL_TEMP_avg > 0) { - fprintf(fp_out, "PL temperature : %ld C\t\t %ld C\n\n",(PL_TEMP)/1000,(PL_TEMP_avg)/1000); + if (PL_TEMP_avg == INVALID_PL_TEMP) { + fprintf(fp_out, "PL Sysmon not available\n\n"); } else { - fprintf(fp_out, "PL Sysmon not available\n\n"); + fprintf(fp_out, "PL temperature : %ld C\t\t %ld C\n\n",(PL_TEMP)/1000,(PL_TEMP_avg)/1000); } } @@ -1160,11 +1161,11 @@ int print_sysmon_power_info(int verbose_flag, int sample_interval, int sample_wi fprintf(fp_out, "VTT PS GTR voltage : %ld mV\n\n",VTT_PS_GTR); fprintf(fp_out, "PL Sysmon\n"); - if (PL_TEMP > 0) { - fprintf(fp_out, "PL temperature : %ld C\n\n",(PL_TEMP)/1000); + if (PL_TEMP == INVALID_PL_TEMP) { + fprintf(fp_out, "PL Sysmon not available\n\n"); } else { - fprintf(fp_out, "PL Sysmon not available\n\n"); + fprintf(fp_out, "PL temperature : %ld C\n\n",(PL_TEMP)/1000); } }