PerformanceCounterCategory 到字符串值
我正在尝试检索 ReadyBoost 缓存的值 我编写了以下代码,但它说该值不存在
System.Diagnostics.PerformanceCounterCategory pc;
pc = new System.Diagnostics.PerformanceCounterCategory("ReadyBoost Cache");
pc.GetCounters("Bytes cached");
MessageBox.Show(Convert.ToString(pc));
拼写正确,我可以看到此代码后面的对象
http://msdn.microsoft.com/en-us/library/2fh4x1xb(v=vs.71).aspx
提前致谢
I am trying to retrieve the value of my readyboost cache I wrote the following code but it says the value does not exist
System.Diagnostics.PerformanceCounterCategory pc;
pc = new System.Diagnostics.PerformanceCounterCategory("ReadyBoost Cache");
pc.GetCounters("Bytes cached");
MessageBox.Show(Convert.ToString(pc));
Spelling is correct, I can see the object following this code
http://msdn.microsoft.com/en-us/library/2fh4x1xb(v=vs.71).aspx
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
GetCounters的参数应该是性能计数器的实例名称。更改您的代码如下:
the parameter of GetCounters should be the instance name of the performance Counter. change your code as follows: