On my system with 32 physical cores I'm constantly spawning 100 threads that run for anywhere between 0 and 3 seconds. After all are finished, the next batch is spawned.
I'd like to get correct average cpu usage, i.e. to what percentage are these cores used on a say 1 minute average. If they are idle for 30% of the time, that value should be 0.7
When using htop, I get a load average of more than 40 which higher than the number of cores However, as can be seen in this video, the CPU cores are not always used to 100%. This is what I expect as all 100 threads have to finish before new ones are generated.
How can I get a more precise measurement of CPU usage?