labled proc times in time debug and added ann full proc time timer

Signed-off-by: Ebbe Baß <ebbe.bass>
main
Ebbe Baß 2024-02-20 15:46:40 +01:00
parent 24ab493067
commit 8e3e6c9d9d
1 changed files with 7 additions and 10 deletions

View File

@ -110,14 +110,12 @@ def connect_mqtt():
return client
def mqtt_publisher(ti_receiver):
start = time.time()
# Create and start a thread for each universe
mqtt_client = connect_mqtt()
artnetBindIp = get_eth0_ip()
artNet = Artnet.Artnet(BINDIP = artnetBindIp, DEBUG = True, SHORTNAME = "PiXelTubeMaster", LONGNAME = "PiXelTubeMaster", PORT = 6454)
end = time.time()
print("1 "+str(end-start))
while True:
start_alltimer = time.time()
try:
start = time.time()
tube_index = ti_receiver.recv()
@ -125,20 +123,19 @@ def mqtt_publisher(ti_receiver):
artNetPacket = artNet.readPacket()
# Make sure we actually *have* a packet
end = time.time()
print("2 "+str(end-start))
print("Receiving of tube index and artnet packet took: "+str(end-start))
if artNetPacket is not None:
start = time.time()
#Checks to see if the current packet is for the specified DMX Universe
dmxPacket = artNetPacket.data
# Create MQTT topic based on the universe and channel
end = time.time()
print("3 "+str(end-start))
print("setting dmxPacket var from artnet data took: "+str(end-start))
if tube_index is not None:
start = time.time()
tube_index = literal_eval(tube_index)
end = time.time()
print("4 "+str(end-start))
start = time.time()
print("Converting tube index back to list wtih leval took: "+str(end-start))
for index_row in tube_index:
start = time.time()
if artNetPacket.universe == int(index_row[1]):
@ -155,13 +152,13 @@ def mqtt_publisher(ti_receiver):
result = str(result_str)
mqtt_client.publish(p1_topic, result)
end = time.time()
print("5 "+str(end-start))
end = time.time()
print("6 "+str(end-start))
print("checking correct universe, converting list to specific pixel and publishing them took: "+str(end-start))
except KeyboardInterrupt:
artNet.close()
end_alltimer = time.time()
print("6 "+str(end_alltimer-start_alltimer))
def tube_index_updater(ti_queue):
while True:
try: