What exactly is CPU Time in task manager?
Asked Answered
P

4

15

I have some WCF services that are hosted in a windows service. Yesterday I looked at Task Manager and noticed that the CPU time for my windows service process was over 5 hours, while the majority of all other processes were at 0.

What does that mean?

Should I be concerned that the CPU Time was 5+ hours?

Pneumato answered 8/5, 2009 at 13:48 Comment(0)
S
20

CPU time is an indication of how much processing time a process has used since it has started (Windows defines it the same way, as documented on Microsoft Learn in this article for Windows 2000).

It is basically calculated by:

CPU Time of Process = Process Uptime * CPU Utilization of Process

For example, if the process has been running for 5 hours and the CPU time is 5 hours, then that means that the process has been utilizing 100% of the resources of the CPU. This may either be a good or bad thing depending on whether you want to keep resource consumption low, or want to utilize the entire power of the system.

If the process was using 50% of the CPU's resource and running for 10 hours, then the CPU time will be 5 hours.

Shostakovich answered 8/5, 2009 at 13:56 Comment(2)
when I run Prime95 cpu time goes higher than the duration Prime95 was running. I can see that for each second, the cpu time increments by ~8 seconds.Testee
@M.kazemAkhgary: Yup, this answer is talking about 100% of one CPU core. Multi-core CPUs were somewhat newish in 2009 and not everyone had one. Multi-threaded code can use more than one CPU-second per wall-clock-second, that's the whole point of multi-threading for computationally intensive tasks. (An equivalent concept is man-hours (person-hours?) per day or per hour of real time, when you have multiple people working on the same project.)Mumps
P
3

CPU Time is a reflection of how much time your program spends executing instructions in the CPU vs waiting for IO or other resources. Should you be concerned with it being 5+ hours?

I would guess not, some things to consider are:

  1. How long has this process been running?

  2. Do you have any issues with the performance of the process or other processes on the box that this might be stealing CPU from?

  3. What other processes do you have? Are these active processes that you'd expect to use the CPU? For reference of the 80 processes I have about 20 have over 1 second of CPU time used.

Edit

It is possible that the WCF service is stealing CPU from the other services, you need to monitor them making sure their performance is what you expect. You can also get a sense based on Total CPU usage. If you for example you only see 25% of your CPU used, then your other services should not be affected; however, if your running above 75% then they might be affected.

When it comes to monitoring be sure to monitor over time so you can see how the performance trends, and it will help you isolate problems. For example you service is running fine but then after a deploy it slowly starts to take more and more CPU (Assume 10% a week). Unless your trending your CPU usage you might one day wake up and see your service running slowly which could be weeks after a deploy.

Piraeus answered 8/5, 2009 at 13:56 Comment(2)
The process had been running for about 3 weeks. It was restarted last night and the CPU time is currently at 31 seconds. We haven't noticed any performance problems - the web site that uses these WCF services is very fast. We have some SOAP web services hosted on the same box in IIS so there was concern that the WCF process might be stealing CPU and affecting the performance of the other web services.Thebaine
You had 5 hours of CPU time on a process that has been running 504 hours (3 weeks * 7 days/week * 24 hours/day). So simplistically, on average, your process has been using 1% of the CPU the entire time. In reality of course, that isn't the case, there are times your service is using near 0% CPU and other times it is using considerably more. I would say it is nothing to worry about, but if you are concerned, you should use 'perfmon' to track your processes CPU usage over time to determine if you have a problem.Ozonide
O
1

If you are concerned about how much CPU time your process is using, you should use perfmon to track your processes' CPU usage over an extended period of time to determine if you have a problem.

Ozonide answered 8/5, 2009 at 22:10 Comment(1)
.@GrantWagner - Do you have any insight on how I can calculate time to turn a core on and off using sysfs?Laryngo
R
0

What exactly is CPU Time in task manager?

Answer is simple :

The total processor time, in seconds, used by the process since it was started.

Rael answered 30/4, 2014 at 8:58 Comment(1)
In minutes. Don't be confused (as I was) by a long-running, low-CPU process -- for a moment I thought CPU Time was hours:minutes, and that it was longer than real-world time since I launched the process. Oops.Catabolism

© 2022 - 2024 — McMap. All rights reserved.