Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Form1()
- {
- InitializeComponent();
- Thread usage = new Thread(new ThreadStart(Usage));
- usage.Start();
- }
- public void Usage()
- {
- PerformanceCounter CpuCounter;
- CpuCounter = new PerformanceCounter();
- CpuCounter.CategoryName = "Processor";
- CpuCounter.CounterName = "% Processor Time";
- CpuCounter.InstanceName = "_Total";
- while (true)
- {
- label3.Text = String.Format("{0}", CpuCounter.NextValue());
- Thread.Sleep(100);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement