% Processor metric in C#

  • Thread starter Thread starter john
  • Start date Start date
Hi,

I think you can use Windows Management Instrumentation for doing such
query. In a nutshell, WMI is an OS instrumentation layer with which you
can interact with queries like
"Select * from Win32_LogicalDisk WHERE FreeSpace < 2000000"

It's pretty cool because you can access lots of machine's resources this
way (processes, I/O, etc.). WMI can also fire events that you can
subscribe (for example if memory comsuption is above certain threshold).


Check the System.Management.Instrumentation in MSDN and the WMI query
language reference in Technet.

HTH,

Ramiro
 
Check the PerformanceCounter class in the System.Diagnostics namespace.

Willy.
 
Back
Top