Display Actual CPU Usage On A UI Canvas

Is there a way in C# to display the actual CPU usage on a UI Canvas using either a Slider or UI Text

@Kiwasi
Thanks I tried that out and it just reads my CPU as 100%And My ram at 0MB

This is the script I used including the UI Text, I’m trying it on a Mac Does it only work on PC

using UnityEngine;
using System.Collections;
using System.Diagnostics;

using UnityEngine.UI;

public class ProfilingScript : MonoBehaviour
{
    PerformanceCounter cpuCounter;
    PerformanceCounter ramCounter;

    public Text cpuText;
    public Text ramText;



    void Start()
    {
        cpuCounter = new PerformanceCounter();

        cpuCounter.CategoryName = "Processor";
        cpuCounter.CounterName = "% Processor Time";
        cpuCounter.InstanceName = "_Total";

        ramCounter = new PerformanceCounter("Memory", "Available MBytes");
    }

    void Update()
    {
        print(getCurrentCpuUsage());
        //cpuText.text = cpuCounter;
        cpuText.text = "CPU: " + getCurrentCpuUsage ();

        print(getAvailableRAM());
        ramText.text = "RAM: " + getAvailableRAM ();
    }

    public string getCurrentCpuUsage(){
        return cpuCounter.NextValue()+"%";
    }

    public string getAvailableRAM(){
        return ramCounter.NextValue()+"MB";
    }
}

3163097--240719--Screenshot 2017-07-28 07.41.24.png