I tested both scenarios with a small change in your Debug code
Used ewbf and set threshold to 100 to see what happenes
added this at the end before done
echo "Debug: JEEP=$JEEP, COUNT=$COUNT, RESTART=$RESTART REBOOTRESET=$REBOOTRESET"
With the original code, wdog resets REBOOTRESET after 5 cycles, with your proposal REBOOTRESET keeps adding up, and wont resets after 5.
So my conclusion is the original code should be correct.
With the THRESHOLD set to 100, you would almost always have a utilization error so the miner would be restarting and eventually the host. This code is not intended for that situation. In fact, your test proves just the opposite of your conclusion. The REBOOTRESET should continue to increase until such a point as the watchdog detects normal mining operations at which point it will hit the else part part of the if (JEEP=0) and will find that REBOOTRESET is greater than 5 and will then set both REBOOTRESET and RESTART to 0.
REBOOTRESET increases by every cycle (10 seconds), no matter if there is a low util, no miner, ...
Take a look at the code you see its on top, before checking utilization
Edit:
I have only 2 cards on my test rig, so I set threshold to 100 to see whats happening when there is low utilization
But when I read your logic again, that should be it, not the way it is now
will test more later
Yeah, when looking at the code, check the other places where REBOOTRESET is changed. Note it is just after 3main is killed:
echo ""
RESTART=$(($RESTART + 1))
REBOOTRESET=0
COUNT=$GPU_COUNT
So, I think the intent of developer was to find a way to reset variable RESTART to 0 to avoid unnecessary host reboots and the best way to do that is only if you can make it through the main loop without any "below utilization" problems.
Also, another minor bug is that REBOOTRESET is never initialized at the beginning of the script. The first reference to it is when it is incremented by 1 within the main [while] loop. I am not sure why that doesn't throw an error.
So I tested more and I think the original works better, why?
With your suggestion REBOOTRESET keeps going up, and when 1 no problem occurs it will reset it to 0
But with original code REBOOTRESET resets every 5 cycles, so after failures wdog should check 5 cycles again until it resets the REBOOTRESET again
Edit 1:
Also it resets after 3main restart, so it will start from 0 after 3main restart, So your suggestion should works too.
I think it has potential to do better, we should work on it.
Problem is it adds to it whether there is low util or not, I think it should only get REBOOTRESET=$(($REBOOTRESET + 1)) if there was no problems at all.
Edit 2:
Suggestion :
add
REBOOTRESET=$(($REBOOTRESET - 1))
in this section:
# If utilization is lower than threshold count them: