public HostMetricsCollector(HostMetricsSettings settings)
        {
            this.settings = settings ?? new HostMetricsSettings();

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                var collector = new NativeHostMetricsCollector_Windows(this.settings);
                nativeCollector        = collector.Collect;
                disposeNativeCollector = collector.Dispose;
            }

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                var collector = new NativeHostMetricsCollector_Linux(this.settings);
                nativeCollector        = collector.Collect;
                disposeNativeCollector = collector.Dispose;
            }

            cache = new ThrottlingCache <HostMetrics>(CollectInternal, CacheTTL);
        }
Beispiel #2
0
 public NativeHostMetricsCollector_Linux(HostMetricsSettings settings)
 {
     this.settings = settings;
     cpuCollector  = new HostCpuUtilizationCollector(GetProcessorCount);
 }
Beispiel #3
0
 public NativeHostMetricsCollector_Windows(HostMetricsSettings settings)
 => this.settings = settings;
Beispiel #4
0
 public HostMonitor(HostMetricsSettings settings)
 => this.settings = settings;