import time begin = time.process_time_ns() your_program() # The program you want to test end = time.process_time_ns() final_time = end - begin # Final time in nanoseconds