FreeSlave / resusage

D library for getting system and process resource usage
Boost Software License 1.0
16 stars 5 forks source link

Do not use CPU count #5

Closed drug007 closed 3 years ago

drug007 commented 5 years ago

Currently resusage divides CPU usage by CPU count i.e. returns average CPU usage for the whole system. This is true if the process really uses all cores and wrong if the application is, for example, single-threaded. Wouldn't it be more correct to return just total usage? Because concerning CPU count we need to determine what amount of cores the application is using that is not trivial in general. For example, top return just total usage.

FreeSlave commented 5 years ago

Makes sense. I'll add a separate method later.

FreeSlave commented 5 years ago

Added a currentTotal method for ProcessCPUWatcher. Do you think it's a good name?

drug007 commented 5 years ago

Good naming is hard) I would suggest usagePerCore/totalUsage. But your variant is good.