Windows Forms: Create CPU & RAM Monitor with Real time Charts in C#

Create CPU & RAM monitor with real time charts using Metro Framework, Performance Counter and Chart control in C#.

Ram & CPU Meter is a small application which resides on your desktop and provides useful information about your computer's processor and memory usage

Step 1: Click New Project, then select Visual C# on the left, then Windows and then select Windows Forms Application. Name your project "CPURAM" and then click OK

cpu and ram monitor with real time chart

Step 2: Right click on your project select Manage NuGet Packages -> Search metro framework -> Install

install metro framework

If you don't see the metro framework in your toolbox, you can view How to download and install metro framework

Step 3: Design ram & cpu meter form as below

cpu and ram monitor with real time chart

Step 4: Add Timer and PerformanceCounter to metro form, then add a tick event handler to timer

private void timer_Tick(object sender, EventArgs e)
    float fcpu = pCPU.NextValue();
    float fram = pRAM.NextValue();
    //Set value to cpu and ram
    metroProgressBarCPU.Value = (int)fcpu;
    metroProgressBarRAM.Value = (int)fram;
    //Update value to cpu and ram label
    lblCPU.Text = string.Format("{0:0.00}%", fcpu);
    lblRAM.Text = string.Format("{0:0.00}%", fram);
    //Draw cpu and ram chart

You should start the timer in Form_Load event

private void Form1_Load(object sender, EventArgs e)