Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8211997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:37:02+00:00 2026-06-07T10:37:02+00:00

been searching around for this for a while, and hoping someone here can answer

  • 0

been searching around for this for a while, and hoping someone here can answer my question. So I am trying to find the best way to get the average CPU usage of 2 or 4 cores. Currently I am using a Performance Counter which so far as I can tell, only returns the usage of a single core. Ideally I would like it to match or at least resemble the Usage bar in Task Manager, and I have looked into WMI queries but was hoping to get some clarification on the best approach. I am currently using an i7, which has hyperthreading, i.e has “8” cores. Not sure if this makes much difference, but though it might.
Thanks for any pointers

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:37:04+00:00Added an answer on June 7, 2026 at 10:37 am

    Using Win32_PerfFormattedData_Counters_ProcessorInformation, you can use the field PercentProcessorTime which will give instances of every core/thread on your system with its respective usage.

    I just tried this on mine, and I got 8 Management Objects for my 8 threads.

    using System;
    using System.Management;
    using System.Windows.Forms;
    
    namespace WMISample
    {
        public class MyWMIQuery
        {
            public static void Main()
            {
                try
                {
                    ManagementObjectSearcher searcher = 
                        new ManagementObjectSearcher("root\\CIMV2", 
                        "SELECT * FROM Win32_PerfFormattedData_Counters_ProcessorInformation"); 
    
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        Console.WriteLine("-----------------------------------");
                        Console.WriteLine("Win32_PerfFormattedData_Counters_ProcessorInformation instance");
                        Console.WriteLine("-----------------------------------");
                        Console.WriteLine("PercentProcessorTime: {0}", queryObj["PercentProcessorTime"]);
                    }
                }
                catch (ManagementException e)
                {
                    MessageBox.Show("An error occurred while querying for WMI data: " + e.Message);
                }
            }
        }
    }
    

    Update:

    That was a slight lie, I got 10 instances.
    Their names were:

    1. _Total
    2. 0,_Total
    3. 0,7
    4. 0,6
    5. 0,5

    etc.
    You should filter out what you need with a where clause:

    SELECT PercentProcessorTime FROM Win32_PerfFormattedData_Counters_ProcessorInformation WHERE NOT Name='_Total' AND NOT Name='0,_Total'

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been searching around trying to find an answer to this question, and I
I've been searching around but can't find much about this, but would cross-casting from
I have been searching around using Google but I can't find an answer to
iv'e been searching around but it's hard to find an answer for this specific
I've been searching around for this but can't seem to find it. I'm having
I've been searching around for this and cannot seem to find a solid answer.
I have been searching around for an answer to this but I can't seem
I've been searching around for an answer for this for a while and have
I've been searching on this around here but I cant seem to find the
I have been searching around Google and this site to find answer on my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.