PerformanceCounter

Following code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Diagnostics;
using UnityEngine.UI;
public class BENCHMARK : MonoBehaviour {

    PerformanceCounter cpuCOUNTER;
    PerformanceCounter ramCOUNTER;

    public Text cpu;
    public Text ram;


   
    void Start()
    {
        cpuCOUNTER= new PerformanceCounter ("Processor", "% Processor Time", "_Total");
  
        ramCOUNTER= new PerformanceCounter ("Memory", "Available MBytes");

    }

    public string getCPU()
    {
            return cpuCOUNTER.NextValue () + "%";
    }
    public string getRAM()
    {
        return ramCOUNTER.NextValue () + "MB";
    }

    void Update()
    {
        cpu.text = "CPU: " + getCPU();
        ram.text = "RAM: " + getRAM ();
    }
}

but all I get is 100% of CPU usage all the time, and 0MB of RAM being used.

I looked at this and this but got nothing.

Hi there! Did you ever solve this? Trying to do the same and getting the same result. I’m absolutely stumped. Thanks!