The Waiting state indicates that a thread is not currently running and is waiting for unlocking. This may be, for example, a result of contention for synchronization objects, garbage collection toggled by other threads, and so on.
Select the Waiting thread state to understand when and why a thread was suspended. For example, to understand how much time a thread waited because of garbage collection on other threads, select the thread in the Threads diagram and the Waiting state in Thread State. The time will be shown in Garbage Collection in the Events filter.
When the Waiting state is selected, the Filters window contains a sub-filter that allows you to refine the resulting filter: Waiting: Activated By.
Waiting: Activated By
The Waiting: Activated By sub-filter shows threads and processes that unlocked the selected threads. This could be useful when you need to understand who blocked a certain thread.
Thread or process name.
Time threads waited before being unblocked by the activating thread or process summed up for all selected threads.
The percentage of time threads waited before being unblocked by the activating thread or process relative to the total selected time.
For example, you want to understand who blocked the Main thread in your app. You choose the Main thread in the Threads diagram and the Waiting state in Thread State. The Waiting: Activated By sub-filter shows the following:
Thread#2 90 ms 90%
Thread#1 10 ms 10%
This means that the Main thread was blocked for 100 ms. In 90% of cases (for 90 ms totally) this was because of the Thread#2 and in 10% of cases (for 10 ms totally) because of Thread#1.
To apply the Waiting: Activated By filter:
- Check the desired activating thread or process in the filter.
After you select a thread or process, other filters will show data only for the time intervals where threads waited before being unblocked by the specified activating thread or process.