performanceCounter组件调用本地计算机的计数器代码如下:
this.performanceCounter1.CategoryName = "Processor";//CPU
this.performanceCounter1.CounterName = "% Processor Time";//CPU百分比
this.performanceCounter1.InstanceName = "_Total";
performanceCounter1.NextValue();//返回经过计算的CPU使用百分比performanceCounter组件调远程计算机的计数器代码如下:
this.performanceCounter1.CategoryName = "Processor";//CPU
this.performanceCounter1.CounterName = "% Processor Time";//CPU百分比
this.performanceCounter1.InstanceName = "_Total";
this.performanceCounter1.MachineName = "172.18.0.25";//设置远程主机IP
performanceCounter1.NextValue();//返回经过计算的CPU使用百分比但是这样执行会出"拒绝访问"的WIN32异常,可能是没权限或者没有建立连接。问题:
1 怎么设置本地和远程主机的访问权限,可以实现调用远程计算机的计数器?
2 有其它的办法请高人指教,这个问题已经难倒很多高手了。(限使用performanceCounter组件)如果你是高手 请指教一下,如果你是新人请你学习一下。 谢谢大家做好了之后 我会公布源码,大家共同学习共同进步,希望进来的朋友都帮忙 顶一下 谢谢
this.performanceCounter1.CategoryName = "Processor";//CPU
this.performanceCounter1.CounterName = "% Processor Time";//CPU百分比
this.performanceCounter1.InstanceName = "_Total";
performanceCounter1.NextValue();//返回经过计算的CPU使用百分比performanceCounter组件调远程计算机的计数器代码如下:
this.performanceCounter1.CategoryName = "Processor";//CPU
this.performanceCounter1.CounterName = "% Processor Time";//CPU百分比
this.performanceCounter1.InstanceName = "_Total";
this.performanceCounter1.MachineName = "172.18.0.25";//设置远程主机IP
performanceCounter1.NextValue();//返回经过计算的CPU使用百分比但是这样执行会出"拒绝访问"的WIN32异常,可能是没权限或者没有建立连接。问题:
1 怎么设置本地和远程主机的访问权限,可以实现调用远程计算机的计数器?
2 有其它的办法请高人指教,这个问题已经难倒很多高手了。(限使用performanceCounter组件)如果你是高手 请指教一下,如果你是新人请你学习一下。 谢谢大家做好了之后 我会公布源码,大家共同学习共同进步,希望进来的朋友都帮忙 顶一下 谢谢
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货