@@ -253,7 +253,7 @@ update_stats() {
253
253
# Get current stats
254
254
local timestamp=$( date ' +%m-%d %H:%M:%S' )
255
255
# For testing, replace the nvidia-smi command with:
256
- # local gpu_stats="44, 0, 3, N/A"
256
+ # local gpu_stats="44, 0, 3, [ N/A] "
257
257
local gpu_stats=$( nvidia-smi --query-gpu=temperature.gpu,utilization.gpu,memory.used,power.draw \
258
258
--format=csv,noheader,nounits 2> /dev/null)
259
259
@@ -265,10 +265,10 @@ update_stats() {
265
265
local temp=$( echo " $gpu_stats " | cut -d' ,' -f1 | tr -d ' ' )
266
266
local util=$( echo " $gpu_stats " | cut -d' ,' -f2 | tr -d ' ' )
267
267
local mem=$( echo " $gpu_stats " | cut -d' ,' -f3 | tr -d ' ' )
268
- local power=$( echo " $gpu_stats " | cut -d' ,' -f4 | tr -d ' ' )
268
+ local power=$( echo " $gpu_stats " | cut -d' ,' -f4 | tr -d ' [] ' ) # Remove both [ and ]
269
269
270
- # Handle N/A power value
271
- if [[ " $power " == " N/A" || -z " $power " ]]; then
270
+ # Handle N/A power value - now handles both N/A and [N/A]
271
+ if [[ " $power " == " N/A" || -z " $power " || " $power " == " [N/A] " ]]; then
272
272
power=" 0" # Using 0 as default for N/A power values
273
273
fi
274
274
0 commit comments