Click here to Skip to main content
15,509,916 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am new to c# please help me with this.

I need help with how can i get the task manager information such as cpu,memory and disk usage in %, using C# objectquery

Thanks and Regards

Prashanth

What I have tried:

I tried for cpu utilization , but it was not accurate
Posted
Updated 15-May-22 5:03am
Comments
Richard MacCutchan 25-Jan-18 4:36am    
Calculating percentages is simple mathematics. What exactly is your problem?
Member 13638860 25-Jan-18 4:38am    
i need to get the percentage of cpu,memory and disk utilized using C# objectquery
Richard MacCutchan 25-Jan-18 4:43am    
Well you already said that.
Member 13638860 25-Jan-18 7:23am    
i need suggestion, as in which WMI to use

Refer this CodeProject article,
Customized Task Manager in .NET using C# and Windows Forms[^]
But you could have found this if you googled it...
 
Share this answer
 
 
Share this answer
 
Actually, it can't be the same as task manager. Because task manager's counter using its own method. Besides that, performance counter is a counter, so it will count the value instead of getting the value of task manager. For answering, i said that it's okay to have a quite different value for your device monitor. And for addition, make sure that you called
C#
cpu_value.NextValue();
function when using performance counter, before inserting the value into form, wpf, or console.

notes: cpu_value is a variable i used for processor's performance counter.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900