Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What does CPU time exactly consist of?

For instance, is the time taken to access a page from the RAM (at which point, the CPU is most likely idling) part of the CPU time? I'm not talking about fetching the page from the disk here, just fetching it from the RAM.

Thanks

share|improve this question

migrated from stackoverflow.com May 1 '10 at 16:44

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers

up vote 1 down vote accepted

CPU "time" is mostly thought of in clock cycles, or the time it takes the processor to execute its smallest instruction (usually integer addition/subtraction). Other instructions, like ram fetching or floating point divides take multiple CPU cycles. Ram load/store typically take more than 1 clock cycle.

parallelism also comes into play. A ram load/store instruction takes a few clock cycles of a memory resource, time where the processor doesn't necessarily have to be idle. Instructions can be ordered to make maximum use of all the resources to get maximum speed. :D

share|improve this answer
add comment

If you are thinking CPU Time in sense of what you can see in Task Manager, it is total time scheduler gave to process.

Each thread in system gets some time to run. If there is no work to do, it will return immediately and thus it will not use that time. In case there is work to do, it will run until scheduler stops it and gives control to another one. That slices of time that thread was actually running are cumulated together and this is CPU time. As thread does more work, more time slices it spends and thus CPU time is higher.

CPU time is not defined in CPU cycles but in "natural" time units (hours, minutes, seconds...).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.