tal tal

tal tal

  • NA
  • 1
  • 1.7k

Collecting trough WMI from Win32_PerfRawData_PerfDisk_Physic

Nov 26 2012 9:22 AM

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