Closed yannrichet closed 3 years ago
also need to have instant usage, not mean value since bootup : top -bn1 | grep "Cpu(s)" | sed "s/., ([0-9.])% id.*/\1/" |awk '{print 100 - $1"%"}'
* <!--UNAVAILABLE_IF test="freecpu=`top -bn1 | grep \"Cpu(s)\" | sed \"s/.*, *\([0-9.]*\)% id.*/\1/\" |awk '{print 100 - $1}'`;if [ $freecpu -ge 90 ]; then echo TRUE; fi"/>
<UNAVAILABLE_IF test="export LANG=C;freecpu=
top -bn1 | grep 'Cpu(s)' | sed 's/., ([0-9.])% id./\1/' |awk '{print 0+$1}';if [ $freecpu -le 20 ]; then echo TRUE; fi"/>
<UNAVAILABLE_IF test="export LANG=C;freecpu=`top -bn2 | grep 'Cpu(s)' | tail -n 1 | sed 's/., ([0-9.])% id./\1/' |awk '{print 0+$1}'`;if [ $freecpu -le 20 ]; then echo TRUE; fi"/>
use load average instead of cpu (which is quite instable) ?
https://github.com/Funz/funz-calculator/blob/dea37310b79cfdc4b53b3f6f070e614b83194115/src/main/java/org/funz/calculator/Calculator.java#L402