Вы можете отслеживать время процессора по:
import time
time_collect = list()
start = time.process_time()
# single line code here
time_collect.append(time.process_time() - start)
# next single code here
time_collect.append(time.process_time() - start)
# next single code here
time_collect.append(time.process_time() - start)
# This line will give you the time for every step after which you append the time
steps_time = [time_collect[i+1] - time_collect[i] for i in range(len(time_collect) - 1)]
Если у вас есть GPU, вам может потребоваться GPUtil , чтобы получить статус от GPU, я не копал их документацию, ноу них есть упоминание о поддержке библиотеки time
в их README.md
.