Christian Elsner
Christian Elsner

Reputation: 123

How to get Free Memory and CPU usage without PerformanceCounter?

I have Windows XP which do not provide the Categories Processor or Memory, and I cannot bring it to show them (I'm not allowed to edit the registry nor to change System Files)

Is there any way to get the actual CPU usage and Free Memory without using PerformanceCounter?

I'm using .NET 3.5 and C# on Windows XP SP2

Upvotes: 2

Views: 4976

Answers (3)

cjb110
cjb110

Reputation: 1471

Would you be able to use native win32 API calls? If so then they would provide the information your after.

See the following article: CodeProject: Calling API functions using C#

Upvotes: 1

Daniel James Bryars
Daniel James Bryars

Reputation: 4621

If you are using .net 4 and you are only interested in what your current app domain is doing then you can use this:

this.AppDomain.MonitoringTotalProcessorTime

See MSDN Documentation MonitoringTotalProcessorTime

Upvotes: 0

Rajesh Subramanian
Rajesh Subramanian

Reputation: 6490

To get the Processor usage without performance counter using WMI, Look at win32_Processor class. and if you want to see the total memory available use GC.GetTotalMemory - Process.GetCurrentProcess().PrivateMemorySize64;

Upvotes: 2

Related Questions