Advertisement
Guest User

Untitled

a guest
May 6th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. public Form1()
  2. {
  3. InitializeComponent();
  4. Thread usage = new Thread(new ThreadStart(Usage));
  5. usage.Start();
  6.  
  7. }
  8. public void Usage()
  9. {
  10. PerformanceCounter CpuCounter;
  11. CpuCounter = new PerformanceCounter();
  12. CpuCounter.CategoryName = "Processor";
  13. CpuCounter.CounterName = "% Processor Time";
  14. CpuCounter.InstanceName = "_Total";
  15. while (true)
  16. {
  17. label3.Text = String.Format("{0}", CpuCounter.NextValue());
  18. Thread.Sleep(100);
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement