import time
def looper(timeCount):
start = time.time()
keepLooping = True
while keepLooping:
if time.time()-start > timeCount:
keepLooping = False
else:
print time.time()-start
time.sleep(0.1)
if __name__ == '__main__':
looper(10.0)
is there way to setup this while loop to run while the cpu is below a specified threshold? to keep it from monopolizing resources.
ReplyDeleteexperimenting with psutil - it works great with linux, but my backup scripts are resource hogs.
@geekbuntu - thanks for the question! I posted my solution to limiting the cpu here. I use the os module so it should be portable across several OSes. Enjoy!
ReplyDelete