X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
To: cygwin@cygwin.com
From: Lapo Luchini <lapo@lapo.it>
Subject:  Re: System load question
Date:  Sat, 15 Dec 2007 13:13:10 +0100
Lines: 27
Message-ID: <fk0gco$rq4$1@ger.gmane.org>
References:  <OFE64087B1.9BD53E7F-ONC1256CF3.004F3E33-C1256CF3.004FC6D6@diamond.philips.com>
Mime-Version:  1.0
Content-Type:  text/plain; charset=ISO-8859-1
Content-Transfer-Encoding:  7bit
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.0
In-Reply-To: <OFE64087B1.9BD53E7F-ONC1256CF3.004F3E33-C1256CF3.004FC6D6@diamond.philips.com>
OpenPGP: id=C8F252FB; 	url=http://www.lapo.it/pgpkey.txt
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.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/

