- Timestamp:
- Feb 18, 2009, 11:57:31 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.