How is threads view useful in performance/cpu profilers?

434 views Asked by At

After I profile an ASP.NET Core application, JetBrain's dotTrace tool by default opens up the All Calls tab and shows a list of threads.

Could you please clarify some of my questions?

  • During my profiling session, I sent around 100K requests to the web application. Are these threads (apart from Main and some system threads like Finalizer thread) the only ones which were used by the thread pool to serve all those requests based on the image below?

  • Ideally I would prefer to know the details of the function that took lot of CPU (i.e hottest method in the profiling session), so I keep wondering how this threads view actually helps?

  • Do you think there could have been many more threads from the thread pool which could have been used and returned back to the thread pool, but the profiler was only able to 'capture' the information of particular thread pool threads because those thread pool threads were executing during that time? I say this because for ~100K requests the number of threads shown here seem less, but I could be wrong. (Probably its based on number of concurrent requests executed?)

enter image description here

enter image description here

1

There are 1 answers

0
Whiletrue On

The Threads view is usefull when you use real Threads in your application. For example, in a WPF the main thread just for dispatcher and your custom thread for background working.

In your case, you still can expand the dispatch to see what's executed inside. You can also use Tracing mode to see the number of request inside a pool worker.

All the threads actually used during your profiling recording are displayed, each thread will execute lots of requests

For this kind of use, I prefer the Timeline mode, so you can filter all your requests and see all the threads where is was executed.