- Timestamp:
- Feb 18, 2009, 11:57:31 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MacFaceLibrary/CPUStatisticsNtQuerySystemInformation.cs
r77 r121 26 26 UInt64 userTime; 27 27 28 SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION sysProcessorPerfInfo; 29 UInt32 outLen; 30 UInt32 len = (UInt32)(Marshal.SizeOf(typeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION))); 31 NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS.SystemProcessorPerformanceInformation, 32 out sysProcessorPerfInfo 33 , len 34 , out outLen); 28 NtKernel.SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION sysProcessorPerfInfo = NtKernel.QuerySystemProcessorPerformanceInfomation(); 35 29 36 30 idleTime = (UInt64)sysProcessorPerfInfo.IdleTime; … … 53 47 ); 54 48 } 55 56 enum SYSTEM_INFORMATION_CLASS57 {58 SystemBasicInformation = 0,59 SystemPerformanceInformation = 2,60 SystemTimeOfDayInformation = 3,61 SystemProcessInformation = 5,62 SystemProcessorPerformanceInformation = 8,63 SystemInterruptInformation = 23,64 SystemExceptionInformation = 33,65 SystemRegistryQuotaInformation = 37,66 SystemLookasideInformation = 4567 }68 69 struct SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION70 {71 public Int64 IdleTime;72 public Int64 KernelTime;73 public Int64 UserTime;74 public Int64 Reserved1_0;75 public Int64 Reserved1_1;76 public Int32 Reserved2;77 }78 79 [DllImport("ntdll.dll")]80 private extern static UInt32 NtQuerySystemInformation(81 SYSTEM_INFORMATION_CLASS SystemInformationClass,82 out SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SystemInformation,83 UInt32 SystemInformationLength,84 out UInt32 ReturnLength85 );86 87 49 } 88 50 }
Note: See TracChangeset
for help on using the changeset viewer.