예제 #1
0
        public static WebApiServerState GetServerState()
        {
            var ram = Windows.Ram.Instance;
            var cpu = Windows.Cpu.Instance;
            var t   = WsServerNodeRedis.GetAllAsync();

            t.Wait();
            var wsServerNodes = t.Result;

            return(new WebApiServerState {
                WsServerNodes = wsServerNodes.OrderBy(a => a.Address).ToList(),
                Address = ServerRoot.HostConfig.ThisServerAddress,
                Description = ServerRoot.HostConfig.Description,
                AvailablePhysicalMemory = ram.AvailablePhysicalMemory,
                TotalPhysicalMemory = ram.TotalPhysicalMemory,
                Cpu = cpu.ToData(),
                OSInfo = Windows.OS.Instance.OsInfo,
                CpuPerformance = cpu.GetTotalCpuUsage(),
                ProcessMemoryMb = VirtualRoot.ProcessMemoryMb,
                ThreadCount = VirtualRoot.ThreadCount,
                HandleCount = VirtualRoot.HandleCount,
                AvailableFreeSpaceInfo = VirtualRoot.GetAvailableFreeSpaceInfo(),
                CaptchaCount = CaptchaSet.Count
            });
        }
예제 #2
0
        public void AvailableFreeSpaceInfoTest()
        {
            Console.WriteLine(VirtualRoot.GetAvailableFreeSpaceInfo());
            NTStopwatch.Start();
            for (int i = 0; i < 1000; i++)
            {
                VirtualRoot.GetAvailableFreeSpaceInfo();
            }
            var elapsedMilliseconds = NTStopwatch.Stop();

            Console.WriteLine(elapsedMilliseconds);
        }