delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/12/15/07:14:02

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Lapo Luchini <lapo AT lapo DOT 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 DOT 9BD53E7F-ONC1256CF3 DOT 004F3E33-C1256CF3 DOT 004FC6D6 AT diamond DOT philips DOT com>
Mime-Version: 1.0
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 AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

jurgen DOT defurne AT philips DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019