Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 关于使用cpucounter和ramcounter_C# - Fatal编程技术网

C# 关于使用cpucounter和ramcounter

C# 关于使用cpucounter和ramcounter,c#,C#,如何使用c检测远程主机的CPU和ram使用情况???您可以使用c PerformanceCounter类来完成这项工作。创建只读计数器相对简单: PerformanceCounter cpuCounter = new PerformanceCounter(category, counter, instance, machine) 文档可在以下位置获得: 我不能100%确定这些是您想要的确切值,但这些可能有效: 中央处理器: 类别=处理器 计数器=%处理器时间 实例=\u总计 内存: 类别=内存

如何使用c检测远程主机的CPU和ram使用情况???

您可以使用c PerformanceCounter类来完成这项工作。创建只读计数器相对简单:

PerformanceCounter cpuCounter = new PerformanceCounter(category, counter, instance, machine)
文档可在以下位置获得:

我不能100%确定这些是您想要的确切值,但这些可能有效:

中央处理器:

类别=处理器 计数器=%处理器时间 实例=\u总计 内存:

类别=内存 计数器=可用兆字节 instance=使用String.Empty 如果你想让你的应用程序在所有现代MS操作系统上运行,那么性能计数器可能会非常棘手。如果你想让你的应用程序以普通非管理员用户的身份运行,事情会变得更加复杂

但这应该让你开始

-丹