I have been using the mstats command to create metrics dashboards etc but what I cant seem to figure out is how the CPU is calculated. I cant seem to get the same result. I am not sure what metric_name is used to get the required result CPU used %.
You should use Processor.%_Processor_Time for Cpu utilization.
See this to learn more about this metric: https://social.technet.microsoft.com/wiki/contents/articles/12984.understanding-processor-processor-...
Processor - % Processor Time is the percentage of elapsed time that the processor spends to execute a non-Idle thread. It is calculated by measuring the percentage of time that the processor spends executing the idle thread and then subtracting that value from 100%. (Each processor has an idle thread that consumes cycles when no other threads are ready to run). This counter is the primary indicator of processor activity, and displays the average percentage of busy time observed during the sample interval.