Logic Machine Forum
LM5 lite: CPU info - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: LM5 lite: CPU info (/showthread.php?tid=2894)



LM5 lite: CPU info - Domoticatorino - 09.10.2020

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


RE: LM5 lite: CPU info - admin - 09.10.2020

Anything above 0.7 is high load. Install system load app and check which process is consuming CPU.


RE: LM5 lite: CPU info - Domoticatorino - 09.10.2020

(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


RE: LM5 lite: CPU info - Erwin van der Zwart - 09.10.2020

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



RE: LM5 lite: CPU info - Domoticatorino - 12.10.2020

(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


RE: LM5 lite: CPU info - Erwin van der Zwart - 14.10.2020

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.


RE: LM5 lite: CPU info - AlexLV - 14.10.2020

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


RE: LM5 lite: CPU info - Daniel - 14.10.2020

Each resident script has only one PID, only event can run many times in parallel