Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public override int GetComputerCpuUsage()
 {
     return(Convert.ToInt32(ManagerGeneric.GetComponent("Win32_PerfFormattedData_PerfOS_Processor", "PercentProcessorTime").ToString()));
 }
Exemplo n.º 3
0
 private int GetFreePhysicalMem()
 {
     return(Convert.ToInt32(Convert.ToString(ManagerGeneric.GetComponent("Win32_OperatingSystem", "FreePhysicalMemory"))) / MegaByte);
 }
Exemplo n.º 4
0
 private int QueLenght()
 {
     return(Convert.ToInt32(ManagerGeneric.GetComponent("Win32_PerfFormattedData_PerfDisk_PhysicalDisk", "AvgDiskQueueLength")));
 }