I need to calculate total '% Processor Time', without using any performance counter.?????
NOTE:
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Abhishek JainRank #1,062 · 1.8K reputationPosted Aug 29, 2013, 6:42 AM EDT
Please try this:
var managementObjectSearcher = new ManagementObjectSearcher(@"\\
ManagementObjectCollection managementObjectCollection = managementObjectSearcher.Get();
ManagementObject managementObject = managementObjectCollection.Cast
int totalTime = managementObject["PercentProcessorTime"];
For this code to work you need to add reference of System.Management.dll to your project.
Regards
AJ