Determine thread wait time in WinDbg with user-mode dump
is there any way in WinDbg to determine since what date/time a Windows thread is blocked by functions like WaitForSingleObject开发者_运维知识库s
or WaitForMultipleObjects
?
I know how to do this in kernel debugging (using !thread
), but I have no idea how to do this in user-mode debugging.
In WinDbg, you can use !runaway
to get thread timings:
!runaway
!runaway 1
(user time)
!runaway 2
(kernel time)
!runaway 4
(elapsed time)
(You'll find these documented as 0, 1 and 2 some places, but in my experience those don't work. Perhaps it depends on the WinDbg version or something...)
You can compute the time spent suspended by subtracting a thread's user and kernel time from it's elapsed time, but unfortunately I don't know of any way (short of writing a WinDbg plugin) to get WinDbg to do that for you.
If you're not set on WinDbg, you can use Process Explorer to get the same information. When you right-click a process and select the threads tab in the properties dialog, you get a list of all the threads in the process. Selecting a particular thread will show the same timing information, among other things.
精彩评论