Re: Got CPU Load incorrectly using script



FYI - I ran your exact script on XPSP2 with NET 1.1 SP1 and NET 2.0
Installed. Get 7% or less most of the time. Since this is an instantaneous
value it probably not much good. You need to use one of the "cooked"
counters to get an average that is meaningful.

I am not sure which is which but I am sure it is documented. Some counters
are for the system while the app is running and others are agnostic. I
would read the SDK documentation very carefully to see which counter you
really want and how to use it.


--
Jim Vierra

"Yu Haitao David" <mshtyu@xxxxxxx> wrote in message
news:%236Ruz7FaFHA.2288@xxxxxxxxxxxxxxxxxxxxxxx
>I got this problem clearly after I install my .NET Framework 1.1 SP1:
>
> I have two scripts to check the CPU load and Memory usage, and I need to
> run
> them one by one to generate data for MRTG. After testing, I found this:
>
> 1. Run checkcpu.vbs first, it returns normal value, 5% for example. There
> appears a process named: wmiprvse.exe
> 2. Run checkmem.vbs then, it gets error: 80041010
>
> if I kill the process wmiprvse.exe that appeared when doing step 1, I
> change
> the order of these two scripts:
>
> 1. Run checkmem.vbs first, it returns normally, another wmiprvse.exe
> appears
> 2. Run checkcpu.vbs then, it runs longer, and return 100% which is
> incorrect
>
> anyone can help me on this?
>
>
>
> "Yu Haitao David" <davidyu@xxxxxxxxxxx> дÈëÓʼþ
> news:OwSGKHBaFHA.2996@xxxxxxxxxxxxxxxxxxxxxxx
>> Hi,
>>
>> I got my CPU load value of 100% whatever it really was in taskmgr.
>>
>> I tried using "Win32_Processor.LoadPercentage" and
>> "Win32_PerfFormattedData_PerfOS_Processor_PercentProcessorTime", always
>> 100%, while actually the load was below 20%.
>>
>> But the script works normally under win2k.
>>
>> My PC has winxp-sp1, and the script like the followings:
>>
>> '=================================
>> On Error Resume Next
>> strComputer = "."
>> Set objWMIService = GetObject("winmgmts:\\" & strComputer &
>> "\root\cimv2")
>> Set colItems = objWMIService.ExecQuery("Select * from
> Win32_Processor",,48)
>>
>> For Each objItem in colItems
>> WScript.Echo "LoadPercentage: " & objItem.LoadPercentage
>> Next
>>
>>
>
>


.



Relevant Pages

  • Newbie question - calling perl from html
    ... various scripts which show how to do it (such as counters, ... display some text on a static web page. ... I have hello.cgi with the following (permissions are 755) ...
    (comp.lang.perl.misc)
  • Re: Got CPU Load incorrectly using script
    ... but it is about two scripts. ... Set wbemObjectSet = objWMIService.ExecQuery("Select * from ... > counters to get an average that is meaningful. ... >>> I got my CPU load value of 100% whatever it really was in taskmgr. ...
    (microsoft.public.windowsxp.wmi)
  • Re: Got CPU Load incorrectly using script
    ... But I need to seperate the codes into different scripts to satisfy graphing ... > For Each wbemObject In wbemObjectSet ... >>> counters to get an average that is meaningful. ... >>> would read the SDK documentation very carefully to see which counter ...
    (microsoft.public.windowsxp.wmi)
  • Re: CPU load
    ... And how can I get CPU load of a another running process? ... The data is maintained in what are called "performance counters". ... I have no idea how to get CPU utilization for ...
    (microsoft.public.vc.language)

Loading