This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: System load question
- From: Lapo Luchini <lapo at lapo dot it>
- To: cygwin at cygwin dot com
- Date: Sat, 15 Dec 2007 13:13:10 +0100
- Subject: Re: System load question
- Openpgp: id=C8F252FB; url=http://www.lapo.it/pgpkey.txt
- References: <OFE64087B1.9BD53E7F-ONC1256CF3.004F3E33-C1256CF3.004FC6D6@diamond.philips.com>
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/