C#,如何使用objectquery在任务管理器中获取cpu,内存和磁盘使用率 [英] C# , how to get cpu, memory and disk usage in % as in task manager using objectquery

查看:165
本文介绍了C#,如何使用objectquery在任务管理器中获取cpu,内存和磁盘使用率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是c的新手#请帮帮我。



我需要帮助,如何获取任务管理器信息,如CPU,内存和磁盘使用情况in%,使用C#objectquery



谢谢和问候



Prashanth



我尝试了什么:



我试过cpu利用率,但是不准确

I am new to c# please help me with this.

I need help with how can i get the task manager information such as cpu,memory and disk usage in %, using C# objectquery

Thanks and Regards

Prashanth

What I have tried:

I tried for cpu utilization , but it was not accurate

推荐答案

可以使用 PerformanceCounter类(System.Diagnostics) [ ^ ]。



还有关于此主题的CodeProject文章:

一个简单的性能计数器应用程序 [ ^ ]

性能计数器简介 [ ^ ]
第10章 - 使用性能计数器 [ ^ ]

处理器计数器 [ ^ ]

< a href =https://msdn.microsoft.com/en-us/library/ms804008.asp x>内存对象 [ ^ ]

Windows性能监视器磁盘计数器说明|询问核心团队 [ ^ ]
Such information can be retrieved with the PerformanceCounter Class (System.Diagnostics)[^].

There are also CodeProject articles about this topic:
A Simple Performance Counter Application[^]
An Introduction To Performance Counters[^]

Some Microsoft links:
Chapter 10 - Working with Performance Counters[^]
Processor Counters[^]
Memory Object[^]
Windows Performance Monitor Disk Counters Explained | Ask the Core Team[^]


请参阅此CodeProject文章,

使用C#和Windows窗体在.NET中定制任务管理器 [ ^ ]

但如果你用Google搜索它就可以找到它...
Refer this CodeProject article,
Customized Task Manager in .NET using C# and Windows Forms[^]
But you could have found this if you googled it...


参见查询WMI(Windows) [ ^ ]


这篇关于C#,如何使用objectquery在任务管理器中获取cpu,内存和磁盘使用率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆