예제 #1
0
        public async Task <SystemOverview> GetSystemOverview()
        {
            var overview = new SystemOverview();

            using (var process = Process.GetCurrentProcess())
            {
                overview.MemoryUsage = ByteDisplayConverter.Convert(process.PrivateMemorySize64);
                var gcMemoryInfo = GC.GetGCMemoryInfo();
                overview.MemoryUsagePercentage = (process.PrivateMemorySize64 / gcMemoryInfo.TotalAvailableMemoryBytes) * 100;
                overview.CpuUsagePercentage    = await GetCpuUsage(process);
            }

            return(overview);
        }
예제 #2
0
 public string GetSizeDisplayModel() => ByteDisplayConverter.Convert(Size ?? 0);