none
Collecting trough WMI from Win32_PerfRawData_PerfDisk_PhysicalDisk Class, cannot understand the Scale RRS feed

  • Question

  • Hey i read from WMI to Get the IOPS for a Disk.

    but when i get the info i don't understand how to read it , the Numbers are to big.

    For Example this is a sample code:

    ManagementScope oMs = new System.Management.ManagementScope("root\\cimv2");
                //Inventory
                ObjectQuery InventQuery = new ObjectQuery("SELECT * FROM Win32_OperatingSystem");
                ManagementObjectSearcher Inventsearcher = new ManagementObjectSearcher(oMs, InventQuery);
                ManagementObjectCollection InventCollection = Inventsearcher.Get();
    
                foreach (ManagementObject mgt in InventCollection)
                {
                    outBox.AppendText(mgt["csname"].ToString() + "\n");
                } 
    
                //Performance
                ObjectQuery PerfQuery = new ObjectQuery("SELECT * FROM Win32_PerfRawData_PerfDisk_PhysicalDisk");
                ManagementObjectSearcher Perfsearcher = new ManagementObjectSearcher(oMs, PerfQuery);
                ManagementObjectCollection PerfCollection = Perfsearcher.Get();
    
                foreach (ManagementObject mgt in PerfCollection)
                {
                    outBox.AppendText("Write IOps: "+  mgt["DiskWritesPerSec"].ToString() + "\n");
                    outBox.AppendText("Read  IOps: " + mgt["DiskReadsPerSec"].ToString() + "\n");
                }

    This is the OutPut:

    Write IOps: 11994709
    Read  IOps: 10541530


    Sunday, November 25, 2012 11:53 AM

Answers

All replies

  • I still don't understand why it happends.

    can anyone help please?

    Monday, November 26, 2012 2:16 PM
  • Hi ShatzTal,

    I will invoke other engineer into this issue.

    Thanks for your patience.

    Best Regards,


    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us


    Tuesday, November 27, 2012 10:14 AM
    Moderator
  • Hi,

    What data do you want to get?   Desk rate of read/write operations per sec or desk?  You can get the more info here,

    http://technet.microsoft.com/en-us/library/cc776376(v=ws.10).aspx

    http://technet.microsoft.com/en-us/library/cc938958.aspx

    Good day!


    Michael Sun [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, November 28, 2012 7:59 AM
  • Hi!

    There's no answer for this question!

    I have the same problem - I cannot take normal data for this counters.

    For Example I have written (with some help of internet) script:

    	param($hostname)

    "Начальный замер" Get-WmiObject -ComputerName $hostname -query "select AvgDisksecPerWrite,AvgDisksecPerWrite_Base,Timestamp_Sys100NS,Frequency_PerfTime from Win32_PerfRawData_PerfDisk_PhysicalDisk where Name ='_Total' " | %{[Int64]$c0w = $_.AvgDisksecPerWrite; [Int64]$c0wb = $_.AvgDisksecPerWrite_Base; $c0t = $_.Timestamp_Sys100NS; $c0f = $_.Frequency_PerfTime} "Sleep 1" sleep 1 "Первый замер" Get-WmiObject -ComputerName $hostname -query "select AvgDisksecPerWrite,AvgDisksecPerWrite_Base,Timestamp_Sys100NS,Frequency_PerfTime from Win32_PerfRawData_PerfDisk_PhysicalDisk where Name ='_Total' " | %{[Int64]$c1w = $_.AvgDisksecPerWrite; [Int64]$c1wb = $_.AvgDisksecPerWrite_Base; $c1t = $_.Timestamp_Sys100NS; $c1f = $_.Frequency_PerfTime} "Sleep 1" sleep 1 "Второй замер" Get-WmiObject -ComputerName $hostname -query "select AvgDisksecPerWrite,AvgDisksecPerWrite_Base,Timestamp_Sys100NS,Frequency_PerfTime from Win32_PerfRawData_PerfDisk_PhysicalDisk where Name ='_Total' " | %{[Int64]$c2w = $_.AvgDisksecPerWrite; [Int64]$c2wb = $_.AvgDisksecPerWrite_Base; $c2t = $_.Timestamp_Sys100NS; $c2f = $_.Frequency_PerfTime} $error | Out-null "Данные 0 замера: $c0w,$c0wb,$c0t,$c0f" "Данные 1 замера: $c1w,$c1wb,$c1t,$c1f" "Данные 2 замера: $c2w,$c2wb,$c1t,$c2f" "" $value1 = ((($c1w - $c0w)/$c0f)/($c1wb-$c0wb)) * 1000 $value2 = ((($c2w - $c0w)/$c0f)/($c2wb-$c0wb)) * 1000 "Value1: $value1" "Value2: $value2"


    As output, I have: 

    Данные 0 замера: 1078799508,3834390,130171594747488490,2241044
    Данные 1 замера: 1078947417,3834541,130171594758219563,2241044
    Данные 2 замера: 1078953692,3834552,130171594758219563,2241044
    
    Value1: 0.43708637640515
    Value2: 0.424691833993332

    But perfmon shows the maximum, at his time : 0,006 on my computer.

    How can I take numbers like in perfmon ?

    Monday, July 1, 2013 1:40 PM