I have a console application which spins up multiple tasks at startup. Further each of these tasks have timers that do various async operations (db reads/writes).
I would like to calculate the CPU usage for each of these startup tasks (should include the sum of usages of the child tasks initiated by them) and log it periodically.
I already checked Get Thread Cpu Usage and How to get the CPU Usage in C#? But these seem to be either for a single thread or the entire process.
Would appreciate any help on this.