0

I am trying to create a program which displays the current CPU % Usage data you would see in task manager. I am using the command from this question:

@for /f "skip=1" %p in ('wmic cpu get loadpercentage') do @echo %p%

Specifically I am running this command through a C# .NET program but I get the same results either way.

My problem is that, while the numbers occasionally make sense, they are generally wrong when compared side by side with Task Manager.

e.g. Task Manager displays 54% usage while my code displays 21% or something like that.

Can anyone explain this? I have tried using the System.Diagnostics PerformanceCounters in C# but it doesn't give my the data I want. Thanks in advance

arc-menace
  • 435
  • 6
  • 19

0 Answers0