frigate icon indicating copy to clipboard operation
frigate copied to clipboard

Request: normalize CPU usage reporting by number of cores

Open roger- opened this issue 2 years ago • 6 comments

I believe the top command gives the CPU usage relatively to a single core. Would it be better to report the CPU usage relative to the total number of cores?

So 40% usage in a four core system is actually 10% relative to the total CPU availability.

Core count can be gotten from /proc/cpuinfo (might be biased with asymmetric cores).

roger- avatar Jan 13 '23 21:01 roger-

This gets confusing especially when you start to consider cores vs hardware threads. To me using the top output directly is good as we know how it works and it is consistent. If anything maybe just have some way of displaying that it is indeed % of 1 core.

NickM-27 avatar Jan 13 '23 21:01 NickM-27

I just think that someone seeing 50% usage on a single core system should be treated differently than on an 8 core system.

If anything maybe just have some way of displaying that it is indeed % of 1 core

That works, how about including the core count too?

roger- avatar Jan 13 '23 21:01 roger-

That works, how about including the core count too?

The more process calls we add to the stats logic the more time it will take to load. Not sure how useful that is personally, but curious what others think.

NickM-27 avatar Jan 13 '23 21:01 NickM-27

I would say that as long as it's clear in the docs what is being displayed - it's fine. Interestingly having information about the number of cores would have helped me massively yesterday as I didn't notice some time ago due to grub change my system started only recognizing a single core which sent me on an all day goose chase through frigate config, different builds etc but how many others are going to benefit I'm not sure.

miczlo avatar Jan 15 '23 07:01 miczlo

Similar to the change I made recently for MEM% I think any change should also consider Docker limits set on the container.

If the host has 8 cores, and Frigate is allocated 2 of them, do you care about Frigate's usage of the 2 it has allocated, or the overall host? I think the correct answer is the former, as what you really care about is how stressed Frigate is.

leccelecce avatar Jan 16 '23 18:01 leccelecce

better to report the CPU usage relative to the total number of cores

@roger- do you mean "average"? The term relative is not super specific. When troubleshooting I usually ignore any relative "CPU" value and go straight to per CPU or core value. Relative values are nice but what I really want to know is if some core (usually the first one - 0) is exhausted. It won't matter if other cores are not utilized, if one of them has all the work and those threads on CPU0 are bottlenecking.

Just tried top in HAOS and pressing "c" switches from a single value to listing numbered cores and per core value.

hackneyb avatar Jan 19 '23 14:01 hackneyb

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Feb 19 '23 00:02 github-actions[bot]