//Dictionary<CounterType, List<CounterInfo>> info = new Dictionary<CounterType, List<CounterInfo>>(); public override void Initialize() { diskReadCounter = new PerformanceCounter("PhysicalDisk", "Disk Read Bytes/sec", "_Total"); diskWriteCounter = new PerformanceCounter("PhysicalDisk", "Disk Write Bytes/sec", "_Total"); /* * info.Add(CounterType.SINGLE, new List<CounterInfo> { * new CounterInfo() { Name = "default", History = new List<float>(), MaximumValue = 1 } * }); * * info.Add(CounterType.MIRRORED, new List<CounterInfo> { * new CounterInfo() { Name = "R", History = new List<float>(), MaximumValue = 1 }, * new CounterInfo() { Name = "W", History = new List<float>(), MaximumValue = 1 } * }); * * info.Add(CounterType.STACKED, new List<CounterInfo> { * new CounterInfo() { Name = "R", History = new List<float>(), MaximumValue = 1 }, * new CounterInfo() { Name = "W", History = new List<float>(), MaximumValue = 1 } * });*/ InfoSummary = new CounterInfo() { Name = "summary", History = new List <float>(), MaximumValue = 1 }; Infos = new List <CounterInfo>(); Infos.Add(new CounterInfo() { Name = "R", History = new List <float>(), MaximumValue = 1 }); Infos.Add(new CounterInfo() { Name = "W", History = new List <float>(), MaximumValue = 1 }); }
//Dictionary<CounterType, List<CounterInfo>> info = new Dictionary<CounterType, List<CounterInfo>>(); public override void Initialize() { ReadCounters(); InfoSummary = new CounterInfo() { Name = "summary", History = new List <float>(), MaximumValue = 1 }; Infos = new List <CounterInfo>(); Infos.Add(new CounterInfo() { Name = "D", History = new List <float>(), MaximumValue = 1 }); Infos.Add(new CounterInfo() { Name = "U", History = new List <float>(), MaximumValue = 1 }); }
//Dictionary<CounterType, List<CounterInfo>> info = new Dictionary<CounterType, List<CounterInfo>>(); public override void Initialize() { ramCounter = new PerformanceCounter("Memory", "Available MBytes"); GetPhysicallyInstalledSystemMemory(out totalMemory); InfoSummary = new CounterInfo() { Name = "summary", History = new List <float>(), MaximumValue = totalMemory / 1024 }; Infos = new List <CounterInfo>(); Infos.Add(new CounterInfo() { Name = "U", History = new List <float>(), MaximumValue = totalMemory / 1024 }); /* * info.Add(CounterType.SINGLE, new List<CounterInfo> { * new CounterInfo() { Name = "default", History = new List<float>(), MaximumValue = totalMemory / 1024 } * });*/ }
public override void Initialize() { cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total"); PerformanceCounterCategory cat = new PerformanceCounterCategory("Processor"); var instances = cat.GetInstanceNames(); /* * info.Add(CounterType.SINGLE, new List<CounterInfo> { * new CounterInfo() { Name = "default", History = new List<float>(), MaximumValue = 100.0f } * }); * * info.Add(CounterType.STACKED, new List<CounterInfo> { * * }); * */ lock (ThreadLock) { InfoSummary = new CounterInfo() { Name = "summary", History = new List <float>(), MaximumValue = 100.0f }; Infos = new List <CounterInfo>(); cpuCounterCores = new List <PerformanceCounter>(); foreach (var item in instances.OrderBy(x => x)) { if (item.ToLower().Contains("_total")) { continue; } // info[CounterType.STACKED].Add(new CounterInfo() { Name = item, History = new List<float>(), MaximumValue = 100.0f }); Infos.Add(new CounterInfo() { Name = item, History = new List <float>(), MaximumValue = 100.0f }); cpuCounterCores.Add(new PerformanceCounter("Processor", "% Processor Time", item)); } } }