Python profiler and processor seconds

Hey, I'm completely on this topic.

Yesterday I was doing profiling using the Python profiling module for some script I'm working on, and the block for the time spent was the "second processor". Can someone remind me of his definition?

For example, for some profiling, I got: 200.750 seconds of the processor. What does it mean? In another case, and for the time-consuming process, I got: -347.977 seconds of the processor, a negative number!

Is there any way to convert this time to calendar time?

Greetings

+4
source share
2 answers

Roughly speaking, processor time, say, 200.75 seconds, means that if only one processor worked on a task, and this processor worked on it all the time, it would take 200.75 seconds. CPU time can be compared with the time of a wall clock, which means the actual time elapsed from the beginning of the task to the end of the task for the clock hanging on the wall of your room.

Both are not interchangeable, and there is no way to convert them into each other, if you do not know exactly how your task was planned and distributed among the kernels of your system. CPU time may be less than wall clock time if the task is distributed among several CPU cores, and this may be longer if the system was under heavy load and your task was temporarily interrupted by other tasks.

+8
source

The second processor is one second when your process is actually scheduled on the CPU. This can be significantly less than the elapsed real time in the case of a busy system, and it can be higher if your process runs on several cores (if the count is performed for each process, and not for the thread). It should never be negative, though ...

+1
source

Source: https://habr.com/ru/post/1308863/


All Articles