I'm writing a small winforms application that opens several instances of another program. To optimize performance I'm looking for a way to find the least used CPU core to assign the process to.
I'd also like to be able to see the usage % of each core. Nothing fancy, a TextBox or Label is fine.
I've been trying to use PerformanceCounter after coming across these answers:
CPU usage for more than 2 cores
I tried implementing these as follows:
        StatusBarOutput.Text = "";
        //ignoring posible hyper-threading for simplicity's sake
        var coreUsages = new PerformanceCounter[Environment.ProcessorCount];
        for (var i = 0; i < coreUsages.Length; i++)
        {
            coreUsages[i] = new PerformanceCounter("Processor", "% Processor Time", i.ToString());
            //using the status bar as output for now, doesn't really matter
            StatusBarOutput.Text += "   |   " + coreUsages[i].CounterName + " ~ " + coreUsages[i].NextValue();
        }
The output I'm getting is:

Meanwhile, the Task manager is showing this:

Not sure what I'm missing here.
 
     
     
    