Changeset 121
- Timestamp:
- Feb 18, 2009, 11:57:31 PM (15 years ago)
- Location:
- trunk/MacFaceLibrary
- Files:
-
- 1 added
- 3 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 } -
trunk/MacFaceLibrary/MacFaceLibrary.csproj
r106 r121 2 2 <PropertyGroup> 3 3 <ProjectType>Local</ProjectType> 4 <ProductVersion> 8.0.50727</ProductVersion>4 <ProductVersion>9.0.21022</ProductVersion> 5 5 <SchemaVersion>2.0</SchemaVersion> 6 6 <ProjectGuid>{23267F41-38FE-41F6-BF08-2D8940A1E024}</ProjectGuid> … … 31 31 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> 32 32 <OutputPath>bin\Debug\</OutputPath> 33 <AllowUnsafeBlocks> false</AllowUnsafeBlocks>33 <AllowUnsafeBlocks>true</AllowUnsafeBlocks> 34 34 <BaseAddress>285212672</BaseAddress> 35 35 <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> … … 96 96 <SubType>Code</SubType> 97 97 </Compile> 98 <Compile Include="NtKernel.cs" /> 98 99 <Compile Include="CPUStatistics.cs"> 99 100 <SubType>Code</SubType> -
trunk/MacFaceLibrary/MemoryStatisticsNtQuerySystemInformation.cs
r98 r121 31 31 protected override MemoryUsage NextValue() 32 32 { 33 Unmanaged.SYSTEM_PERFORMANCE_INFORMATION sysPerfInfo = new MacFace.MemoryStatisticsNtQuerySystemInformation.Unmanaged.SYSTEM_PERFORMANCE_INFORMATION(); 34 Int32 sysInfoLen = Marshal.SizeOf(typeof(Unmanaged.SYSTEM_PERFORMANCE_INFORMATION)); 35 UInt32 retLen; 36 37 Unmanaged.NtQuerySystemInformation(Unmanaged.SYSTEM_INFORMATION_CLASS.SystemPerformanceInformation, 38 out sysPerfInfo, 39 (UInt32)sysInfoLen, 40 out retLen); 33 NtKernel.SYSTEM_PERFORMANCE_INFORMATION sysPerfInfo = NtKernel.QuerySystemPerformanceInformation(); 41 34 42 35 UInt32 pageSize = 4096; … … 61 54 (UInt64)sysPerfInfo.SystemCodePage * pageSize); 62 55 } 63 64 private class Unmanaged65 {66 public enum SYSTEM_INFORMATION_CLASS67 {68 SystemBasicInformation = 0,69 SystemPerformanceInformation = 2,70 SystemTimeOfDayInformation = 3,71 SystemProcessInformation = 5,72 SystemProcessorPerformanceInformation = 8,73 SystemInterruptInformation = 23,74 SystemExceptionInformation = 33,75 SystemRegistryQuotaInformation = 37,76 SystemLookasideInformation = 4577 }78 79 [StructLayout(LayoutKind.Sequential)]80 public struct SYSTEM_PERFORMANCE_INFORMATION81 {82 public Int64 IdleTime;83 public Int64 ReadTransferCount;84 public Int64 WriteTransferCount;85 public Int64 OtherTransferCount;86 public UInt32 ReadOperationCount;87 public UInt32 WriteOperationCount;88 public UInt32 OtherOperationCount;89 public UInt32 AvailablePages;90 public UInt32 TotalCommittedPages;91 public UInt32 TotalCommitLimit;92 public UInt32 PeakCommitment;93 public UInt32 PageFaults;94 public UInt32 WriteCopyFaults;95 public UInt32 TransitionFaults;96 public UInt32 CacheTransitionFaults;97 public UInt32 DemandZeroFaults;98 public UInt32 PagesRead;99 public UInt32 PageReadIos;100 public UInt32 CacheReads;101 public UInt32 CacheIos;102 public UInt32 PagefilePagesWritten;103 public UInt32 PagefilePageWriteIos;104 public UInt32 MappedFilePagesWritten;105 public UInt32 MappedFilePageWriteIos;106 public UInt32 PagedPoolUsage;107 public UInt32 NonPagedPoolUsage;108 public UInt32 PagedPoolAllocs;109 public UInt32 PagedPoolFrees;110 public UInt32 NonPagedPoolAllocs;111 public UInt32 NonPagedPoolFrees;112 public UInt32 TotalFreeSystemPtes;113 public UInt32 SystemCodePage;114 public UInt32 TotalSystemDriverPages;115 public UInt32 TotalSystemCodePages;116 public UInt32 SmallNonPagedLookasideListAllocateHits;117 public UInt32 SmallPagedLookasideListAllocateHits;118 public UInt32 Reserved3;119 public UInt32 MmSystemCachePage;120 public UInt32 PagedPoolPage;121 public UInt32 SystemDriverPage;122 public UInt32 FastReadNoWait;123 public UInt32 FastReadWait;124 public UInt32 FastReadResourceMiss;125 public UInt32 FastReadNotPossible;126 public UInt32 FastMdlReadNoWait;127 public UInt32 FastMdlReadWait;128 public UInt32 FastMdlReadResourceMiss;129 public UInt32 FastMdlReadNotPossible;130 public UInt32 MapDataNoWait;131 public UInt32 MapDataWait;132 public UInt32 MapDataNoWaitMiss;133 public UInt32 MapDataWaitMiss;134 public UInt32 PinMappedDataCount;135 public UInt32 PinReadNoWait;136 public UInt32 PinReadWait;137 public UInt32 PinReadNoWaitMiss;138 public UInt32 PinReadWaitMiss;139 public UInt32 CopyReadNoWait;140 public UInt32 CopyReadWait;141 public UInt32 CopyReadNoWaitMiss;142 public UInt32 CopyReadWaitMiss;143 public UInt32 MdlReadNoWait;144 public UInt32 MdlReadWait;145 public UInt32 MdlReadNoWaitMiss;146 public UInt32 MdlReadWaitMiss;147 public UInt32 ReadAheadIos;148 public UInt32 LazyWriteIos;149 public UInt32 LazyWritePages;150 public UInt32 DataFlushes;151 public UInt32 DataPages;152 public UInt32 ContextSwitches;153 public UInt32 FirstLevelTbFills;154 public UInt32 SecondLevelTbFills;155 public UInt32 SystemCalls;156 }157 158 [DllImport("ntdll.dll")]159 public extern static UInt32 NtQuerySystemInformation(160 SYSTEM_INFORMATION_CLASS SystemInformationClass,161 out SYSTEM_PERFORMANCE_INFORMATION SystemInformation,162 UInt32 SystemInformationLength,163 out UInt32 ReturnLength164 );165 }166 167 56 } 168 57 }
Note: See TracChangeset
for help on using the changeset viewer.