Display CPU usage on a UI Slider or Text

I’m not sure if this is possible so I’m just going to put this out there.
Is there a way to display your actual CPU usage on either a UI slider or Text or both?

I have tried this but can’t seem to get it to do anything but display a CPU value of 100% and a ram value of 0MB, I’m using a mac, does this only work on Windows?

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";
	} 
}