public AboutHost Get() { var a = new AboutHost { Version = typeof(AboutHost).GetTypeInfo().Assembly.GetName().Version, OSDescription = RuntimeInformation.OSDescription, Is64BitOperatingSystem = RuntimeInformation.OSArchitecture == Architecture.X64, Is64BitProcess = RuntimeInformation.ProcessArchitecture == Architecture.X64, ProcessorCount = Environment.ProcessorCount, #if !NETSTANDARD1_6 WorkingSet = Environment.WorkingSet, #endif ConnectedUserCount = _sessionManager.GetUsers().Count() }; var memoryInfo = _systemInfo.GetMemoryInformation(); a.TotalVirtualMemory = memoryInfo.TotalVirtualMemory; a.FreeVirtualMemory = memoryInfo.FreeVirtualMemory; a.TotalPhysicalMemory = memoryInfo.TotalPhysicalMemory; a.FreePhysicalMemory = memoryInfo.FreePhysicalMemory; a.VideoCards = _systemInfo.GetVideoControllerInformation().Select(ci => new VideoCardInfo() { VideoCardName = ci.VideoCardName, VideoRAM = ci.VideoRAM, VideoProcessor = ci.VideoProcessor }).ToArray(); var latest = _interpManager.Interpreters.Latest(); a.Interpreters = _interpManager.Interpreters.Select(x => x.Id == latest.Id ? Invariant($"[{x.Id}] {x.Name} ({Resources.Default})") : Invariant($"[{x.Id}] {x.Name}")).ToArray(); return(a); }
private void UpdateMeasurement(object state) { var memoryInfo = _systemInfo.GetMemoryInformation(); _hostLoad.MemoryLoad = (double)(memoryInfo.TotalPhysicalMemory - memoryInfo.FreePhysicalMemory) / memoryInfo.TotalPhysicalMemory; _hostLoad.CpuLoad = _systemInfo.GetCpuLoad(); _hostLoad.NetworkLoad = _systemInfo.GetNetworkLoad(); }