0

I need to convert PagesPersec value from Win32_PerfRawData_PerfOS_Memory to PerfFormatted Data value .How to convert PerfRaw data values from WMI Perfomance counters to PerfFormatted Data values .Is there Standard Formula available recommended by Windows.

RRUZ
  • 134,889
  • 20
  • 356
  • 483

2 Answers2

1

The formula you need depends on the CounterType ... see http://msdn.microsoft.com/en-us/library/aa392761(v=VS.85).aspx

to get started, have a look at http://msdn.microsoft.com/en-us/library/aa394597.aspx

Tobi Oetiker
  • 5,167
  • 2
  • 17
  • 23
0

It is too long to answer here. There is a very good article with samples http://msdn.microsoft.com/en-us/library/ms974615.aspx

In a brief: it depends on the counter type. For some counters it can me just read (disk free space) and come require calculation based on two requests one a bit later than another, for example:

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
    ("Select * From Win32_PerfRawData_PerfOS_Processor Where Name = '0'")
For Each objItem in colItems
    CounterValue1 = objItem.InterruptsPerSec
    TimeValue1 = objItem.TimeStamp_PerfTime
    TimeBase = objItem.Frequency_PerfTime
Next
For i = 1 to 5
    Wscript.Sleep(1000)
    Set colItems = objWMIService.ExecQuery _
       ("Select * From Win32_PerfRawData_PerfOS_Processor Where Name = '0'")
    For Each objItem in colItems
        CounterValue2 = objItem.InterruptsPerSec
        TimeValue2 = objItem.TimeStamp_PerfTime
        If TimeValue2 - TimeValue1 = 0 Then
            Wscript.Echo "Interrupts Per Second = 0"
        Else
            intInterrupts = (CounterValue2 - CounterValue1) / _
                ( (TimeValue2 - TimeValue1) / TimeBase)
            Wscript.Echo "Interrupts Per Second = " & Int(intInterrupts)
        End if
        CounterValue1 = CounterValue2
        TimeValue1 = TimeValue2
    Next
Next
Putnik
  • 5,925
  • 7
  • 38
  • 58