using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using rtChart; using System.Diagnostics; namespace YLcpuPerf { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Paint(object sender, PaintEventArgs e) { } private void button1_Click(object sender, EventArgs e) { kayChart cpuData = new kayChart(chart1, 60); cpuData.serieName = "CPU"; Task.Factory.StartNew(() => { cpuData.updateChart(updateWithCPU, 1000); }); } PerformanceCounter cpu = new PerformanceCounter("Processor Information", "% Processor Time","_Total"); private double updateWithCPU() { return cpu.NextValue(); } } }