import time import os start_ts = time.time() loops = 0 while True: time.sleep(1) loops += 1 tick_ts = time.time() delta = int(tick_ts - start_ts) pid = os.getpid() print("I'm {} and I've been running for {} seconds and did {} loops".format(pid, delta, loops))