Pregunta: | 67338 - PROBLEMA TIMER PHYTON |
Autor: | Arnold Bazaldua |
El codigo es: import thread import time import timeit t1 = time.time() t2 = time.time() t3 = time.time() t4 = time.time() listadeimp = [] def imp1(b1,t1): for x in range(0,b1): b1=x*x+7*x+10 listadeimp.append(b1) print(time.time() - t1,"seg") def imp2(c1,t2): for x in range(b1,c1): c1=x*x+7*x+10 listadeimp.append(c1) print(time.time() - t2,"seg") def imp3(d1,t3): for x in range(c1,d1): d1=x*x+7*x+10 listadeimp.append(d1) print(time.time() - t3,"seg") def imp4(e1,t4): for x in range(d1,e1): e1=x*x+7*x+10 listadeimp.append(e1) print(time.time() - t4,"seg") def main(): global b1,c1,d1,e1,t1,t2,t3,t4 b1=26 c1=51 d1=76 e1=101 thread.start_new_thread(imp1,(b1,t1)) thread.start_new_thread(imp2,(c1,t2)) thread.start_new_thread(imp3,(d1,t3)) thread.start_new_thread(imp4,(e1,t4)) print(listadeimp) #print(thread.isAlive) main() Que puedo hacer para que imprima el tiempo de ejecucion de cada hilo cuando TERMINE el hilo o MINTRAS se sta ejecutando?? Supongo que es con isAlive pero me dirian como puedo implementarlo?? gracias |