我怎样才能获得在C#(托管代码)A *螺纹*的CPU使用率和/或RAM使用? [英] How can I get CPU usage and/or RAM usage of a *THREAD* in C# (managed code)?
本文介绍了我怎样才能获得在C#(托管代码)A *螺纹*的CPU使用率和/或RAM使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道如何让CPU使用率和内存使用情况的过程,但我想知道如何得到它在每个线程级。如果最好的解决办法是做一些P-中调用,那也没关系。
什么,我需要的,例如:
发MyThread的= Thread.CurrentThread;
//一段时间后,在其他一些功能...
Console.WriteLine(GetThreadSpecificCpuUsage(MyThread的));
解决方案
下面是这你想要做什么$ B $为例b http://www.codeproject.com/KB/system/processescpuusage.aspx
I know how to get CPU usage and memory usage for a process, but I was wondering how to get it on a per-thread level. If the best solution is to do some P-Invoking, then that's fine too.
Example of what I need:
Thread myThread = Thread.CurrentThread;
// some time later in some other function...
Console.WriteLine(GetThreadSpecificCpuUsage(myThread));
解决方案
Here's an example which does what you want http://www.codeproject.com/KB/system/processescpuusage.aspx
这篇关于我怎样才能获得在C#(托管代码)A *螺纹*的CPU使用率和/或RAM使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文