windows 使用用户模式转储确定 WinDbg 中的线程等待时间
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5451216/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Determine thread wait time in WinDbg with user-mode dump
提问by
is there any way in WinDbg to determine since what date/time a Windows thread is blocked by functions like WaitForSingleObjects
or WaitForMultipleObjects
?
WinDbg 中是否有任何方法可以确定 Windows 线程被诸如WaitForSingleObjects
或 之类的函数阻塞的日期/时间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.
我知道如何在内核调试中执行此操作(使用!thread
),但我不知道如何在用户模式调试中执行此操作。
采纳答案by Tim Sylvester
In WinDbg, you can use !runaway
to get thread timings:
在 WinDbg 中,您可以使用!runaway
获取线程计时:
!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...)
(你会发现这些在某些地方被记录为 0、1 和 2,但根据我的经验,那些不起作用。也许这取决于 WinDbg 版本或其他东西......)
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.
您可以通过从经过的时间中减去线程的用户和内核时间来计算挂起的时间,但不幸的是,我不知道有什么方法(缺少编写 WinDbg 插件)让 WinDbg 为您做到这一点。
If you're not set on WinDbg, you can use Process Explorerto 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.
如果您没有在 WinDbg 上设置,您可以使用Process Explorer来获取相同的信息。当您右键单击进程并在属性对话框中选择线程选项卡时,您将获得进程中所有线程的列表。选择特定线程将显示相同的计时信息等。