PerformanceCounter PC = new PerformanceCounter();//性能计数器
PC.CategoryName = "Process";//性能计数器-进程
PC.CounterName = "% Processor Time";//
PC.InstanceName = othervlcprocess.ProcessName;
然后用PC.NextValue()取出来的值一直为零,其实othervlcprocess.ProcessName该进程一直占有3%左右的cpu,
这是为什么,请高手指点!
PC.CategoryName = "Process";//性能计数器-进程
PC.CounterName = "% Processor Time";//
PC.InstanceName = othervlcprocess.ProcessName;
然后用PC.NextValue()取出来的值一直为零,其实othervlcprocess.ProcessName该进程一直占有3%左右的cpu,
这是为什么,请高手指点!
解决方案 »
- div里面的问题!
- 关于.net aspnet_wp.exe 加载项目慢的问题
- 为什么不更新数据库(access)??
- Retrieving the COM class factory for component with CLSID 错误
- 求一段js在线能
- 请问 脚本如何取得 <asp:Image ID="Image1" runat="server" ImageUrl="~/image/male.gif" /> 的ImageUrl完整路径
- 我的第一个.net作品,请大家pp!! http://www.topdomain.cn/newweb/eng/main.aspx
- DataNavigateUrlFormatString="detailspage.aspx?id={0}" 的问题
- 请教!
- DropDownList显示数据库内容不正常,怎么弄?
- 图片中alt属性显示问题
- 调试出现错误
部分内容:
很多人在使用PerfomanceCounter的时候直接new PerfomanceCounter实例,然后就去调用NextValue()方法。这样往往得到的值是0.00,今天我也犯了这么错误,找个了半天,终于发现,performance counter在计算值得时候,需要两个样本,如果我们获取到PerformanceCounter后直接调用NextValue()方法,则只会获取到第一个样本的值,该值往往会是0