コード例 #1
0
ファイル: SystemInfo.cs プロジェクト: njs/FetchClimate
        public static PerformanceInformation GetCurrent()
        {
            PerformanceInformation pi = new PerformanceInformation();

            if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi)))
            {
                return(pi);
            }
            else
            {
                throw new InvalidOperationException("GetPerformanceInfo returns false");
            }
        }
コード例 #2
0
ファイル: SystemInfo.cs プロジェクト: njs/FetchClimate
        public static int GetMemoryUsage()
        {
            var pi = PerformanceInformation.GetCurrent();

            return((int)(100 * pi.CommitTotal / pi.PhysicalTotal));
        }
コード例 #3
0
ファイル: SystemInfo.cs プロジェクト: njs/FetchClimate
 public static extern bool GetPerformanceInfo([Out] out PerformanceInformation PerformanceInformation, [In] int Size);