Ignore:
Timestamp:
Feb 18, 2009, 11:57:31 PM (15 years ago)
Author:
rryu
Message:

NtQuerySystemInformation周りの実装をNtKernelクラスとしてまとめてみた。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MacFaceLibrary/CPUStatisticsNtQuerySystemInformation.cs

    r77 r121  
    2626                        UInt64 userTime;
    2727
    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();
    3529                       
    3630                        idleTime = (UInt64)sysProcessorPerfInfo.IdleTime;
     
    5347                        );
    5448                }
    55 
    56                 enum SYSTEM_INFORMATION_CLASS
    57                 {
    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 = 45
    67                 }
    68 
    69                 struct SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
    70                 {
    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 ReturnLength
    85                 );
    86 
    8749        }
    8850}
Note: See TracChangeset for help on using the changeset viewer.