Dec-29-2017, 09:45 AM
from threading import Thread import time def PR01(): k = 0 while (k < 25000000): k = k + 1 def PR02(): k = 0 while (k < 25000000): k = k + 1 # defining the time now in epoch format def thetime(): return int(time.time()) print "only start here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" task_start = thetime() k = 0 while (k < 25000000): k = k + 1 k = 0 while (k < 25000000): k = k + 1 task_end = "%05d" % (thetime() - task_start,) print("original = " + str(task_end)) task_start = thetime() p01 = Thread(name='PR01', target=PR01) p02 = Thread(name='PR02', target=PR02) p01.start() p01.join() p02.start() p02.join() task_end = "%05d" % (thetime() - task_start,) print("processed 1 = " + str(task_end)) print "only done here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"