WMI 性能计数器查询问题
有没有一种方法可以通过 C# 中的 WMI 进行查询,就像使用 System.Diagnostics.PerformanceCounter 类一样?
简而言之,我如何向它传递一个像 \\localhost\Processor(0)\% Processor Time
这样的字符串,它会为我构建正确的 WMI 查询?
我在遗留程序的平面文件中有大量计数器列表,我想将其移动到仅运行平面文件并获取值的服务。
Is there a way to query via WMI in C# like you can do with the System.Diagnostics.PerformanceCounter
class?
Simply put how can I pass it a string like \\localhost\Processor(0)\% Processor Time
and it would build the correct WMI query for me?
I have huge list of counters in a flat file from a legacy program and I want to move it to a Service which just runs through the flat file and gets the value.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 WMI 性能等级计数器。一个例子是轮询 PerfDisk_LogicalDisk
You can use the WMI Performance Class Counters. An example of this would be polling the PerfDisk_LogicalDisk