add variable that saves previous x states, if you check every 20 seconds, then for 3 minutes you have to increase counter if load is above your mark and set to 0 if it is not above your mark. if mark is 9 then reboot.
also, i would suggest to solve that problem different way - beeing pegged to max does not mean anything good