public ProcessorUnitTime(string ip, string username, string password) { pc = new WmiPerfRawDataPerfOSProcessor(ip, username, password); Win32PerfRawDataPerfOSProcessor wprdp = pc.Win32PerfRawDataPerfOSProcessors[pc.Win32PerfRawDataPerfOSProcessorsLength - 1]; frequency_PerfTime = wprdp.Frequency_PerfTime; dPCRate = wprdp.DPCRate; oldtimestamp_PerfTime = wprdp.Timestamp_PerfTime; olddPCsQueuedPersec = wprdp.DPCsQueuedPerSec; oldinterruptsPerSec = wprdp.InterruptsPerSec; oldpercentDPCTime = wprdp.PercentDPCTime; oldtimestamp_Sys100NS = wprdp.Timestamp_Sys100NS; oldpercentInterruptTime = wprdp.PercentInterruptTime; oldpercentPrivilegedTime = wprdp.PercentPrivilegedTime; oldpercentProcessorTime = wprdp.PercentProcessorTime; oldpercentUserTime = wprdp.PercentUserTime; Thread.Sleep(500); pc = new WmiPerfRawDataPerfOSProcessor(ip, username, password); Win32PerfRawDataPerfOSProcessor wprdp1 = pc.Win32PerfRawDataPerfOSProcessors[pc.Win32PerfRawDataPerfOSProcessorsLength - 1]; newtimestamp_PerfTime = wprdp1.Timestamp_PerfTime; newdPCsQueuedPersec = wprdp1.DPCsQueuedPerSec; newinterruptsPerSec = wprdp1.InterruptsPerSec; newpercentDPCTime = wprdp1.PercentDPCTime; newtimestamp_Sys100NS = wprdp1.Timestamp_Sys100NS; newpercentInterruptTime = wprdp1.PercentInterruptTime; newpercentPrivilegedTime = wprdp1.PercentPrivilegedTime; newpercentProcessorTime = wprdp1.PercentProcessorTime; newpercentUserTime = wprdp1.PercentUserTime; }
protected override void FillFloppyDriveInfo() { ManagementObjectCollection moc = this.GetAllInfo(this.WSql); foreach (ManagementObject mo in moc) { Win32PerfRawDataPerfOSProcessor csp = new Win32PerfRawDataPerfOSProcessor(); if (mo != null) { csp.C1TransitionsPerSec = GetManagementObject <ulong>(mo, "C1TransitionsPerSec"); csp.C2TransitionsPerSec = GetManagementObject <ulong>(mo, "C2TransitionsPerSec"); csp.C3TransitionsPerSec = GetManagementObject <ulong>(mo, "C3TransitionsPerSec"); csp.Caption = GetManagementObject <string>(mo, "Caption"); csp.Description = GetManagementObject <string>(mo, "Description"); csp.DPCRate = GetManagementObject <uint>(mo, "DPCRate"); csp.DPCsQueuedPerSec = GetManagementObject <uint>(mo, "DPCsQueuedPerSec"); csp.Frequency_Object = GetManagementObject <ulong>(mo, "Frequency_Object"); csp.Frequency_PerfTime = GetManagementObject <ulong>(mo, "Frequency_PerfTime"); csp.Frequency_Sys100NS = GetManagementObject <ulong>(mo, "Frequency_Sys100NS"); csp.InterruptsPerSec = GetManagementObject <uint>(mo, "InterruptsPerSec"); csp.Name = GetManagementObject <string>(mo, "Name"); csp.PercentC1Time = GetManagementObject <ulong>(mo, "PercentC1Time"); csp.PercentC2Time = GetManagementObject <ulong>(mo, "PercentC2Time"); csp.PercentC3Time = GetManagementObject <ulong>(mo, "PercentC3Time"); csp.PercentDPCTime = GetManagementObject <ulong>(mo, "PercentDPCTime"); csp.PercentIdleTime = GetManagementObject <ulong>(mo, "PercentIdleTime"); csp.PercentInterruptTime = GetManagementObject <ulong>(mo, "PercentInterruptTime"); csp.PercentPrivilegedTime = GetManagementObject <ulong>(mo, "PercentPrivilegedTime"); csp.PercentProcessorTime = GetManagementObject <ulong>(mo, "PercentProcessorTime"); csp.PercentUserTime = GetManagementObject <ulong>(mo, "PercentUserTime"); csp.Timestamp_Object = GetManagementObject <ulong>(mo, "Timestamp_Object"); csp.Timestamp_PerfTime = GetManagementObject <ulong>(mo, "Timestamp_PerfTime"); csp.Timestamp_Sys100NS = GetManagementObject <ulong>(mo, "Timestamp_Sys100NS"); ps.Add(csp); } } moc.Dispose(); }