Monitor a process's usage of each CPU core

后端 未结 4 1396
春和景丽
春和景丽 2021-02-13 02:01

Is there a way to query or calculate the CPU usage of a single process per each core separately?

For example,

Na

4条回答
  •  北荒
    北荒 (楼主)
    2021-02-13 02:20

    There is a way to get that information, you will need to use a Kernel Debugger. My suspect were that if the Visual Studio Concurrency Visualizer can get this information to make beautiful reports and visualizations, then you can also get it from the Windows Kernel for you use.

    You can see some documentation here http://msdn.microsoft.com/en-us/library/windows/hardware/ff552961(v=vs.85).aspx .

    But more interesting things can be found by reversing the Microsoft.ConcurrencyVisualizer.dll that can be found on Visual Studio 2012 installation directory. I think you can also use directly this DLL on your project, although you cannot redeploy it as per http://msdn.microsoft.com/en-US/vstudio/hh857605#files. That DLL is available standalone here http://www.microsoft.com/en-us/download/details.aspx?id=41646.

    The idea is to learn how this DLL uses the Kernel Trace to know what Thread was on what Core and replicate it to get accurate statistics. Also, I think that ProcessExplorer does get some stats by using the Kernel Debugger API because the Visual Studio conflicts with it when I start the Concurrency Visualizer tool.

    This will be fun and hard to do.

提交回复
热议问题