Kaynağa Gözat

add: timer exec time

micha 3 yıl önce
ebeveyn
işleme
aa9f3c657a
3 değiştirilmiş dosya ile 12 ekleme ve 2 silme
  1. 6 0
      _LibreLightDesk.py
  2. 4 1
      console.py
  3. 2 1
      lib/chat.py

+ 6 - 0
_LibreLightDesk.py

@@ -164,7 +164,10 @@ INT   = ["DIM","SHUTTER","STROBE","FUNC"]
 #client = chat.tcp_sender(port=50001)
 jclient = chat.tcp_sender()#port=50001)
 def jclient_send(data):
+    t_start = time.time()
     jclient.send("\00 "+ json.dumps(data) +"\00 ")
+    print(time.time()-t_start)
+    cprint(time.time(),color="yellow")
 
 class _FadeTime():
     def __init__(self):
@@ -1459,6 +1462,7 @@ class GUI(Base):
                     FIXTURES.fixtures[fix]["ATTRIBUT"][attr]["ACTIVE"] = 1
                     elem["bg"] = "yellow"
     def preset_go(self,nr,val=None,xfade=None,event=None):
+        t_start = time.time()
         if xfade is None and FADE._is():
             xfade = FADE.val()
         
@@ -1507,6 +1511,7 @@ class GUI(Base):
         if not (modes.val("FLASH") or ( "BUTTON" in cfg and cfg["BUTTON"] == "FL")): #FLASH
             self.refresh_exec()
             self.refresh_fix()
+        cprint("preset_go",time.time()-t_start)
 
     def _preset_go(self,rdata,cfg,fcmd,value=None,xfade=None,event=None,xFLASH=0):
         if xfade is None and FADE._is():
@@ -2097,6 +2102,7 @@ class Fixtures(Base):
                 data = self.fixtures[fix]
                 for attr in data["ATTRIBUT"]:
                     data["ATTRIBUT"][attr]["FX"] = ""
+                    data["ATTRIBUT"][attr]["FX2"] = OrderedDict()
     def get_attr(self,fix,attr):
         if fix in self.fixtures:
             data = self.fixtures[fix]

+ 4 - 1
console.py

@@ -425,11 +425,12 @@ def split_cmd(data):
 import time
 import json
 def JCB(data):
+    t_start = time.time()
     #jdatas = data["cmd"].split("\x00")
     jdatas = [data["cmd"]]
-    #print("JCB")
     c = clock.time() 
     c = float(c)
+    print("JCB",round(c,2))
     ftime = 0
     delay = 0
     for j in jdatas:
@@ -522,6 +523,8 @@ def JCB(data):
                     else:
                         CB({"cmd":"fx"+ccm})
 
+            print(time.time()-t_start)
+            print(time.time())
             return
         except Exception as e:
             cprint("EXCEPTION JCB",e,color="red")

+ 2 - 1
lib/chat.py

@@ -160,6 +160,8 @@ class CMD():
                                 cb({"c":client_nr,"cmd":cmd})
 
 
+                        else:
+                            time.sleep(0.0001)
                         #else: #workaround json sock pkg-drops
                         #    print("+++ Verbindung zu %s beendet" % ip)
                         #    sock.close()
@@ -167,7 +169,6 @@ class CMD():
                         #        client_nr = clients.index(sock)
                         #        clients2[client_nr] = ""
                         #    clients.remove(sock)
-                        time.sleep(0.0001)
         except KeyboardInterrupt:
             print(" strg+c")
         finally: