This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

CPU Load Log as Trend
#8
(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.
Reply


Messages In This Thread
CPU Load Log as Trend - by manos@dynamitec - 10.09.2019, 13:27
RE: CPU Load Log as Trend - by Daniel - 10.09.2019, 13:37
RE: CPU Load Log as Trend - by Daniel - 10.09.2019, 14:02
RE: CPU Load Log as Trend - by admin - 11.09.2019, 06:33
RE: CPU Load Log as Trend - by Jørn - 16.04.2020, 06:15
RE: CPU Load Log as Trend - by admin - 16.04.2020, 06:24

Forum Jump: