16.04.2020, 06:15
(11.09.2019, 06:33)admin Wrote: Use this script to log CPU load to an object. Resident script sleep time controls how often load is calculated.
Code:data = io.readfile('/proc/uptime'):split(' ')
total, idle = tonumber(data[ 1 ]), tonumber(data[ 2 ])
if prevtotal then
deltatotal = total - prevtotal
deltaidle = idle - previdle
load = math.floor((1 - (deltaidle / deltatotal)) * 100 + 0.5)
grp.update('32/0/0', load)
end
prevtotal, previdle = total, idle
What datatype would appropiate for this output`?
Best regards, Jørn.