public override ComputerSummary GetComputerSummary() { ComputerSummary comSum = new ComputerSummary { Name = Environment.MachineName }; try { comSum.CpuUsage = Convert.ToInt32(ManagerGeneric.GetComponent("Win32_PerfFormattedData_PerfOS_Processor", "PercentProcessorTime").ToString()); } catch { comSum.CpuUsage = -1; } comSum.User = Environment.UserName; comSum.Cpu = ManagerGeneric.GetComponent("Win32_OperatingSystem", "OSArchitecture").ToString(); comSum.AvailableDiskSpaceGb = FreeSpace(); comSum.AverageDiskQueueLength = QueLenght(); comSum.Ram = GetRam(); comSum.VideoCard = GetVideoCard(); comSum.Ip = GetLocalIPAddress(); //We get current ram use by substracting free physical memory from total memory comSum.RamUsage = comSum.Ram - GetFreePhysicalMem(); return(comSum); }
public override int GetComputerCpuUsage() { return(Convert.ToInt32(ManagerGeneric.GetComponent("Win32_PerfFormattedData_PerfOS_Processor", "PercentProcessorTime").ToString())); }
private int GetFreePhysicalMem() { return(Convert.ToInt32(Convert.ToString(ManagerGeneric.GetComponent("Win32_OperatingSystem", "FreePhysicalMemory"))) / MegaByte); }
private int QueLenght() { return(Convert.ToInt32(ManagerGeneric.GetComponent("Win32_PerfFormattedData_PerfDisk_PhysicalDisk", "AvgDiskQueueLength"))); }