slow processing
Posted: Fri Mar 04, 2016 2:36 pm
hi all, I have some code that is a compilation of various small scripts checking inputs, changing outputs and presenting the results on a screen using tkinter.. when compiling the code using pycharm on my pc.. 8core 32gb ram.. it run beautifully but when sent to pi the update to tkinter and navigating between screens as Ive put a settings menu in there was taking 3-5 seconds.. this is probably due to the 11 threads its trying to run and I do intend on revamping the code to fewer threads, but most threads are set to sleep every 30 sec then change a global variable, other threads are set to update the relevant tkinter label every second for the clock and every 15 seconds otherwise. (but the clock is missing multiple seconds between each update on pi)
the threads which do not have sleep are set by multiple variables such as..
with this example in the instance where int_0 = 0 and int_1 = 0 there is no code to run so I would presume non of the cpu/ram is used for that task? or am I wrong? also does the sleep command use any resources?
is there anyway to benchmark test each part of my code to see how much resources that particular part is using, or a way to see live cpu/ram usage then I can just watch as each particular part is run?
also when I change the page on the tkinter window I'm running for each and every button and label from the previous page that the new page is accessible from, which is an extensive list, is there any way to clear the form that would be quicker or without python having to read 30+ lines of code?
the threads which do not have sleep are set by multiple variables such as..
Code: Select all
while 1:
if int_0 == 1 and int_1 == 0 and run_cycle == 0:
(code to run)
run_cycle = 1
if int_0 == 1 and int_1 == 1 and run_cycle == 1:
(code to run)
run_cycle = 0is there anyway to benchmark test each part of my code to see how much resources that particular part is using, or a way to see live cpu/ram usage then I can just watch as each particular part is run?
also when I change the page on the tkinter window I'm running
Code: Select all
.grid_forget