Esempio n. 1
0
        /// <summary>
        /// Updates the dynamic information of the client
        /// </summary>
        private void UpdateClientInfo()
        {
            // RAM information
            var ci = new ComputerInfo();

            _clientInfo.TotalMemory = ci.TotalPhysicalMemory;
            _clientInfo.UsedMemory  = ci.TotalPhysicalMemory - ci.AvailablePhysicalMemory;
            // CPU information
            _clientInfo.CpuUsage = CpuUsageReader.GetValue();
            // Disk information
            _clientInfo.DiskInformations = new List <DiskInformation>();
            foreach (var drive in DriveInfo.GetDrives())
            {
                if (drive.IsReady && drive.DriveType == DriveType.Fixed)
                {
                    var diskInformation = new DiskInformation
                    {
                        Name           = drive.Name,
                        Label          = drive.VolumeLabel,
                        TotalDiskSpace = (ulong)drive.TotalSize,
                        FreeDiskSpace  = (ulong)drive.TotalFreeSpace,
                    };
                    _clientInfo.DiskInformations.Add(diskInformation);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Updates the dynamic information of the client
        /// </summary>
        private void UpdateClientInfo()
        {
            // RAM information
            var ci = new ComputerInfo();

            ClientInfo.TotalMemory = ci.TotalPhysicalMemory;
            ClientInfo.UsedMemory  = ci.TotalPhysicalMemory - ci.AvailablePhysicalMemory;
            // CPU information
            ClientInfo.CpuUsage = CpuUsageReader.GetValue();
        }
Esempio n. 3
0
        /// <summary>
        /// Get statistics about the server and the job handlers
        /// </summary>
        public ServerInfo GetStatistics()
        {
            var info = new ServerInfo();
            // RAM information
            var ci = new ComputerInfo();

            info.TotalMemory = ci.TotalPhysicalMemory;
            info.UsedMemory  = ci.TotalPhysicalMemory - ci.AvailablePhysicalMemory;
            // CPU information
            info.CpuUsage = CpuUsageReader.GetValue();
            // Handler statistics
            var handlerStats = _handlerManager.GetStatistics();

            info.Handlers.AddRange(handlerStats);
            // Client statistics
            info.Clients.AddRange(_clientManager.GetStatistics().OrderBy(i => i.ClientInfo.Name));
            return(info);
        }
Esempio n. 4
0
        /// <summary>
        /// Get statistics about the server and the job handlers
        /// </summary>
        public ServerInfo GetStatistics()
        {
            var info = new ServerInfo();
            // RAM information
            var ci = new ComputerInfo();

            info.TotalMemory = ci.TotalPhysicalMemory;
            info.UsedMemory  = ci.TotalPhysicalMemory - ci.AvailablePhysicalMemory;
            // CPU information
            info.CpuUsage = CpuUsageReader.GetValue();
            // Handler information
            var handlerStats = _handlerManager.GetStatistics();

            info.Handlers.AddRange(handlerStats);
            // Client information
            foreach (var kvp in _knownClients)
            {
                var clientInfo = kvp.Value;
                info.Clients.Add(clientInfo);
            }
            return(info);
        }