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.

LM5 lite: CPU info
#1
Dear all,
I have a LM with this CUP info "CPU/IO1.00 1.00 1.00".  

How can I consider this values? Are good? Not good? How can I improve them if it needs?

Memory is 20%.

Thanks.

BR
Reply
#2
Anything above 0.7 is high load. Install system load app and check which process is consuming CPU.
Reply
#3
(09.10.2020, 09:49)admin Wrote: Anything above 0.7 is high load. Install system load app and check which process is consuming CPU.

Thank you Admin, I have seen that the following "resident Script" which I set to 0 second is too heavy.


night = grp.getvalue('32/1/6')
res = {}
objs = grp.tag('cancello')
for _, obj in ipairs(objs) do
  if obj.value and night == true then
    grp.write('0/0/84', true)
    os.sleep(600)
  grp.write('0/0/84', false)
      end
end

I should use a event base script but I do not know how manage delay of 600 seconds. What do you suggest please?

Thanks.

Br
Reply
#4
Try this as event based on the TAG "cancello":
Code:
if event.getvalue() == true then
  previouspid = storage.get('PID:' .. _SCRIPTNAME)
  storage.set('PID:' .. _SCRIPTNAME, os.getpid())
  if previouspid then
    os.kill(previouspid, signal.SIGKILL)
  end
  night = grp.getvalue('32/1/6')
  if night == true then
    grp.checkwrite('0/0/84', true)
    os.sleep(600)
    grp.checkwrite('0/0/84', false)
  end
  storage.delete('PID:' .. _SCRIPTNAME)
end
Reply
#5
(09.10.2020, 21:33)Erwin van der Zwart Wrote: Try this as event based on the TAG "cancello":
Code:
if event.getvalue() == true then
  previouspid = storage.get('PID:' .. _SCRIPTNAME)
  storage.set('PID:' .. _SCRIPTNAME, os.getpid())
  if previouspid then
    os.kill(previouspid, signal.SIGKILL)
  end
  night = grp.getvalue('32/1/6')
  if night == true then
    grp.checkwrite('0/0/84', true)
    os.sleep(600)
    grp.checkwrite('0/0/84', false)
  end
  storage.delete('PID:' .. _SCRIPTNAME)
end

Thank you very much Erwin. Just one question: previouspid is a local variable? I can use the same variable name for other event script or shall I use other name in order to avoid problem?

Thanks.
Br
Reply
#6
Yes you can use it in multiple scripts without changed, that’s why i use _SCRIPTNAME as storage name so each script has a unique name by default.
Reply
#7
Hi,

Erwin, I have some old installations (based on old for now LM3). There also sleep commands many used. Is possible some how check how many parallel processes or scripts started on LM? Or I simply need to add additional script lines to every resident script to control loop processes? How to analyze such things?

BR,

Alex
Reply
#8
Each resident script has only one PID, only event can run many times in parallel
------------------------------
Ctrl+F5
Reply


Forum Jump: