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