From b477c4ad1e2bede74b5ff06e5d5df9001abd2f20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Tue, 20 Feb 2024 16:20:28 +0100 Subject: [PATCH] added time mesurement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- client/main.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/client/main.py b/client/main.py index fc8f7f5..02468f7 100644 --- a/client/main.py +++ b/client/main.py @@ -77,22 +77,33 @@ if __name__ == "__main__": mqttc.loop_start() while True: + start = time.time() for pixel in range(LEDS_PER_PIXEL): update_led_strip(tuple(eval(rgb_values_list[0])), pixel, strip) - + end = time.time() + print("Pixel 1 took: "+str(end-start)) + start = time.time() for pixel in range(LEDS_PER_PIXEL, LEDS_PER_PIXEL*2): update_led_strip(tuple(eval(rgb_values_list[1])), pixel, strip) - + end = time.time() + print("Pixel 2 took: "+str(end-start)) + start = time.time() for pixel in range(LEDS_PER_PIXEL*2, LEDS_PER_PIXEL*3): update_led_strip(tuple(eval(rgb_values_list[2])), pixel, strip) - + end = time.time() + print("Pixel 3 took: "+str(end-start)) + start = time.time() for pixel in range(LEDS_PER_PIXEL*3, LEDS_PER_PIXEL*4): update_led_strip(tuple(eval(rgb_values_list[3])), pixel, strip) - + end = time.time() + print("Pixel 4 took: "+str(end-start)) + start = time.time() for pixel in range(LEDS_PER_PIXEL*4, LEDS_PER_PIXEL*5): update_led_strip(tuple(eval(rgb_values_list[4])), pixel, strip) - + end = time.time() + print("Pixel 5 took: "+str(end-start)) + start = time.time() for pixel in range(LEDS_PER_PIXEL*5, LEDS_PER_PIXEL*6): update_led_strip(tuple(eval(rgb_values_list[5])), pixel, strip) - - time.sleep(0.5) \ No newline at end of file + end = time.time() + print("Pixel 6 took: "+str(end-start)) \ No newline at end of file