This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: System load question


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]