astrofrog/psrecord

CPU usage

ducarios opened this issue ยท 5 comments

Why does the percentage of CPU usage exceed 100%? I do not understand why the values written to the log file exceed 100.

thx for the help.

Same here, sometimes I get 6000% with a process that uses openmp, even if I divide the percentage by my number of CPUs (8), the resultant percentage does not make sense to me.

I would it be nice if someone can explain us why percentage exceed 100%.

Cheers

Same here, sometimes I get 6000% with a process that uses openmp, even if I divide the percentage by my number of CPUs (8), the resultant percentage does not make sense to me.

I would it be nice if someone can explain us why percentage exceed 100%.

Cheers

From what I have seen using other libraries, it seems the usage is of all threads. It can be that program is using only 6 threads. It's a theory tho. I can't say if it is true or not.

In some cases this can be due to multi-threading, but I sometimes see this for single-threaded processes, and it can usually be fixed by specifying the interval explicitly, e.g. --interval 0.1. If the interval is too short, there are some numerical issues with determining the CPU % I think.

just for the record, I observed the same behavior and as psrecord is using the function cpu_percent() from psutil I found an explanation on its documentation https://psutil.readthedocs.io/en/latest/#psutil.Process.cpu_percent:

the returned value can be > 100.0 in case of a process running multiple threads on different CPU cores.

Related question in psutil.