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 8304435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:51:03+00:00 2026-06-08T17:51:03+00:00

I am working on a large application and want to get an idea of

  • 0

I am working on a large application and want to get an idea of how loaded the CPU was between two points in time. I am not just interested in my own process, but all processes.

My idea is to get the Total CPU Time of the Idle Process between two time periods. Then compare that value to the real time difference. It is then possible to calculate the average % CPU Time spent on the Idle process, and hence the average % CPU spent on actual processes.

For instance:

  • Real Time Samples: 2012/07/30 13:56:1 and 2012/07/30 13:56:21
  • Idle Process Total CPU Time Samples: 56:23:10 and 56:23:15
  • Difference in Real Time: 20s
  • Difference in Idle Process Total CPU Time: 5s
  • Average % CPU Time in Idle Process: 25%
  • Average % CPU Time in Actual Processes: 75%

In order to have as little performance impact as possible, I only want to take two samples. One at the beginning and one at the end.

I also do not want to look at other processes in order to calculate the total CPU load, only the Idle Process. (For instance I don’t want to calculate the sum of Total CPU Time of other processes)

I have tried to use the Kernel32.dll OpenProcess. But apperantly you cannot access the Idle Process. It throws an ERROR_ACCESS_DENIED exception.

This must be possible as Task Manager displays the Total CPU Time of the Idle Process.

NOTE: I am NOT interested in the Instantaneous % CPU Time of the Processes. Only the Total CPU Time in order to calculate the average later.

  • 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-08T17:51:04+00:00Added an answer on June 8, 2026 at 5:51 pm

    You are probably looking for something like this:

    static Program
    {
        private static PerformanceCounter cpuCounter = new PerformanceCounter() { 
            CategoryName = "Processor", 
            CounterName = "% Processor Time", 
            InstanceName = "_Total" };
    
        static void Main()
        {
            cpuCounter.NextValue();
            // Do your processing here.
            float totalCpuUsagePercentage = cpuCounter.NextValue();
        }
    }
    

    totalCpuUsagePercentage will then contain the total load in percentage since the last cpuCounter.NextValue().

    If you don’t want the percentage you can use CounterName = “Processor Time” instead.

    Hope that this will help you on your quest.

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

Sidebar

Related Questions

I am working on Alarm application in which I want to set Large Sound
I'm working with a rather large .net web application. Users want to be able
I'm working on a somewhat large-scale JS application and I want to break out
I am working on a large scale application. I carefully try to handle all
I am working on a large web application implemented in ASP.net. The main part
I have been working on a large java application. It is quite parallel, and
I am working on a large php/mysql application, and I am getting to the
I'm currently working on a large and old C++ application that has had many
I'm currently working on my first deployment of a large server side application which
I am working on an application that processes a large number of files placed

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.