System load question

Lapo Luchini lapo@lapo.it
Sat Dec 15 12:13:00 GMT 2007


jurgen.defurne@philips.com wrote:
> Does the loadavg work however ?

I found that system load can be somewhat seen with the following VBS
script (available since WinXP):

Set objWMIService = GetObject("winmgmts:root\cimv2")
Set objRefresher = CreateObject("WbemScripting.Swbemrefresher")
Set objProcessor = objRefresher.AddEnum(objWMIService, _
    "Win32_PerfFormattedData_PerfOS_Processor").objectSet
Do
    objRefresher.Refresh
    For Each intProcessorUse in objProcessor
	If intProcessorUse.Name = "_Total" Then
	    WScript.StdOut.WriteLine _
                FormatDateTime(Now,vbShortDate) & vbTab & _
		FormatDateTime(Now,vbShortTime) & vbTab & _
		intProcessorUse.PercentProcessorTime
	End If
    Next
    Wscript.Sleep 1000 ' Sleep in mSec.
Loop

I haven't investigated if it shows the instant load or the average over
the sampling period, but I have the impression it is the latter.

    Lapo


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list