private void CreatePerformanceGraph(string instanceName, string counterName)
 {
     var perfData = new PerformanceData(new PerformanceCounter("Process", counterName, instanceName));
     var filteredData = new FilteringDataSource<PerformanceInfo>(perfData, new MaxSizeFilter());
     var dataSource = new EnumerableDataSource<PerformanceInfo>(filteredData);
     dataSource.SetXMapping(pi => (pi.Time.TimeOfDay.TotalSeconds - (_currentTotal == 0 ? _currentTotal = pi.Time.TimeOfDay.TotalSeconds : _currentTotal)));
     dataSource.SetYMapping(pi => Proc.GetCpuValue(pi.Value));
     Plotter.AddLineGraph(dataSource, 0.8, string.Format("{0} - {1}", counterName, instanceName));
 }
Esempio n. 2
0
		private LineGraph CreateFilteredPerformanceGraph(string categoryName, string counterName, string instanceName, IFilter<PerformanceInfo> filter)
		{
			PerformanceData data = new PerformanceData(new PerformanceCounter(categoryName, counterName, instanceName));

			var filteredData = new FilteringDataSource<PerformanceInfo>(data, filter);

			var ds = new EnumerableDataSource<PerformanceInfo>(filteredData);
			ds.SetXMapping(pi => pi.Time.TimeOfDay.TotalSeconds);
			ds.SetYMapping(pi => pi.Value);

			LineGraph chart = plotter.AddLineGraph(ds, 2.0, String.Format("{0} - {1}", categoryName, counterName));
			return chart;
		}