Hi Shanmugavel,
Win32_PerfFormattedData_PerfOS_Processor.PercentProcessorTime in the script that you posted is the CPU usage -- per processors/cores indeed. I'm afraid, it's not clear from your post what issues you're having with this code.
Could you please clarify which exactly CPU usage do you need? --
- A list of CPU usage per each process (application) (marked 1 in the attached screenshot)
- CPU usage for a specific process (application)
- Total CPU usage (marked 2 on the attached screenshot)
- Something else
Also, why don't TestComplete's
Sys.CPUUsage and
Sys.Process(...).CPUUsage suit your needs? Is it because you are planning to run this code using wscript/cscript outside of TestComplete?