C# .Net Equivalent of NtQuerySystemInformation ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What I need to be able to detect is when the CPU or CPUs of a system are idle
or no more than 10% busy. Back in my C++ days we used
NtQuerySystemInformation. Is there an easier way built into the .Net
Platform or C#?
 
I think it in System.Diagnostics.PerformanceCounter. Search for
PerformanceCounter in this group and you should be able to find what
you want.
 
John,

Thanks for the reply. I found a way to use performance counters but there
seems to be no way to handle multiple CPUs
 
I don't know what you found out and I don't have multiple CPU machine
to test.

But how about this?
CategoryName = "Process"; // Instead of processor
CounterName = "% Processor Time";
InstanceName = "Idle";
MachineName = "MY-MACHINE";
 
Thanks John,

Yes, that may work because it is looking at the Idle process itself. I will
have to try it and see what happens.
 
Back
Top