如何知道线程是否并行运行

问题描述:

是否有可用的工具来告知进程的线程是否在多核处理器上并行运行?在Visual Studio中进行调试时,调试->线程"窗口会显示所有正在运行的线程.但是如何知道它们是否并行运行.

Is there any tool available which tells whether threads of a process are running in parallel on multi core processor? While debugging in visual studio, Debug->Thread windows shows all running threads. But how to know if they are running in parallel .

SinghMKC,

Hi SinghMKC,

我相信并发可视化工具可能是您正在寻找的工具.

I believe the Concurrency Visualizer might be the tool you are looking for.

请参见下图,以获取结果示例.
您将在水平轴上看到与线程和彩色块相对应的水平泳道,这些线程和有色块指定了它们的活动类型.深绿色的块意味着执行,并且您可以看到可以选择一个块来显示其调用堆栈.

Please see the following figure for an example how its results look like.
You will see horizontal lanes corresponding to threads and colored blocks designating the type of their activity with time on the horizontal axis. Dark green blocks mean execution, and as you can see a single block can be selected to reveal its call stack.

您可以从Visual Studio画廊下载Visual Studio 2013的并发可视化工具:
http://visualstudiogallery.msdn.microsoft.com/24b56e51-fcc2-423f-b811-f16f3fa3af7a
它是Visual Studio 2012内置的.

You can download the Concurrency Visualizer for Visual Studio 2013 from the Visual Studio Gallery:
http://visualstudiogallery.msdn.microsoft.com/24b56e51-fcc2-423f-b811-f16f3fa3af7a
It is built-in for Visual Studio 2012.

该文档在MSDN上可用: http://msdn.microsoft.com/zh-CN/library/dd537632.aspx

The documentation is available on MSDN: http://msdn.microsoft.com/en-us/library/dd537632.aspx