protected override Gauge32 GetData() { var memInfo = _metricCacher.GetValue <MemInfo>(MetricCacher.Keys.Server.MemInfo); var value = (Size)_propertyInfo.GetValue(memInfo); return(new Gauge32(value.GetValue(SizeUnit.Bytes))); }
internal static MachineResources GetMachineResources(MetricCacher metricCacher, LowMemoryMonitor lowMemoryMonitor, ICpuUsageCalculator cpuUsageCalculator) { var memInfo = metricCacher.GetValue <MemoryInfoResult>(MetricCacher.Keys.Server.MemoryInfoExtended); var cpuInfo = metricCacher.GetValue(MetricCacher.Keys.Server.CpuUsage, cpuUsageCalculator.Calculate); var machineResources = new MachineResources { TotalMemory = memInfo.TotalPhysicalMemory.GetValue(SizeUnit.Bytes), AvailableMemory = memInfo.AvailableMemory.GetValue(SizeUnit.Bytes), AvailableWithoutTotalCleanMemory = memInfo.AvailableWithoutTotalCleanMemory.GetValue(SizeUnit.Bytes), SystemCommitLimit = memInfo.TotalCommittableMemory.GetValue(SizeUnit.Bytes), CommittedMemory = memInfo.CurrentCommitCharge.GetValue(SizeUnit.Bytes), ProcessMemoryUsage = memInfo.WorkingSet.GetValue(SizeUnit.Bytes), IsWindows = PlatformDetails.RunningOnPosix == false, IsLowMemory = LowMemoryNotification.Instance.IsLowMemory(memInfo, lowMemoryMonitor, out var commitChargeThreshold), LowMemoryThreshold = LowMemoryNotification.Instance.LowMemoryThreshold.GetValue(SizeUnit.Bytes), CommitChargeThreshold = commitChargeThreshold.GetValue(SizeUnit.Bytes), MachineCpuUsage = cpuInfo.MachineCpuUsage, ProcessCpuUsage = cpuInfo.ProcessCpuUsage }; return(machineResources); }
protected override Gauge32 GetData() { return(new Gauge32((int)_metricCacher.GetValue(MetricCacher.Keys.Server.CpuUsage, _calculator.Calculate).MachineCpuUsage)); }
protected override Gauge32 GetData() { return(new Gauge32(_metricCacher.GetValue <MemoryInfoResult>( MetricCacher.Keys.Server.MemoryInfoExtended).WorkingSetSwapUsage.GetValue(SizeUnit.Megabytes))); }
protected GCMemoryInfo GetGCMemoryInfo() { return(_metricCacher.GetValue <GCMemoryInfo>(_cacheKey)); }