Processor Utilization - NEC Express5800/R120b-2 User Manual

Hide thumbs Also See for Express5800/R120b-2:
Table of Contents

Advertisement

I-8 Accessing Power and Performance Data

PROCESSOR UTILIZATION

To collect the utilization of processors, use Win32_PerfFormattedData_PerfOS_Processor class
provided with the Windows OS.
Shown below is a sample file created by Visual Basic Script (e.g. Proc.vbs).
In this script, the processor utilization is collected every 30 seconds.
' Start Script
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
set objRefresher = CreateObject("WbemScripting.Swbemrefresher")
Set objProcessor = objRefresher.AddEnum _
(objWMIService, "Win32_PerfFormattedData_PerfOS_Processor").objectSet
objRefresher.Refresh
Dim first
first = true
Do
For each intProcessorUse in objProcessor
If first Then
If intProcessorUse.Name = "_Total" Then
first = false
End If
else
Wscript.Echo "Proc" & intProcessorUse.Name & " : " & _
End If
Next
Wscript.Sleep 30*1000
objRefresher.Refresh
Loop
' End Script
Command Line (Example)
C:\VBS> cscript //nologo Proc.vbs
"PercentProcessorTime=" & _
intProcessorUse.PercentProcessorTime
'sleep 30 * 1000ms

Advertisement

Table of Contents
loading

Table of Contents