I am using the timeit command which is provided as part of the Windows 2003 Resource Kit to measure the time it takes to execute particular tasks. Attached is the output of a process I was running however am confused by the difference in the elapsed and processed times. What are these, why are they different and which one of the 2 provides an indication of a real wall clock?

enter image description here


Elapsed Time is the duration from when the process was started until the time it terminated ("real wall clock" time, as you put it). Process Time is the time that the CPU spent on computing the process. I'm surprised that your process time is higher than the "real time", though. Perhaps the process used more than one core and the process times of all cores were summed up?

  • Thanks Ansgar. I was running the process using 2 cores. I am however having a hard time understanding why CPU time as they call it would take longer when multiple CPUs or cores are being used considering Process or CPU time takes no consideration of events such as reading the file from the harddrive, mouse clicks, etc. I would have thought that the sum value would be much less as the task was spread between 2 cores in this example. Sep 20 '12 at 19:45
  • 1
    When each of the two cores takes 10 seconds for calculating results then the total calculation time has been 10 second times two, but because both calculations ran in parallel, the calculation took only 10 seconds "real time". Had you been doing all of the calculation on a single core, the process time would still be 20 seconds, but the elapsed time would have doubled from 10 to 20 seconds (because the calculations would have had to be done one after the other). Sep 20 '12 at 19:53
  • When is Process or CPU time vital to use and understand? For example the code I plan to run will be deployed on a server running a multitude of other jobs. Sep 20 '12 at 19:56
  • 1
    It allows you to (roughly) estimate bottlenecks. Examples: process time << elapsed time => process is I/O-bound, i.e. you can't scale out by using more or faster CPUs. process time (1 core) ~= elapsed time => process is CPU-bound, i.e. you can scale out by using a faster CPU (or perhaps more cores). process time (n cores) ~= elapsed time => process is CPU-bound, but can't be parallelized, i.e. you can only scale out with a faster CPU, not with additional CPUs/cores. Sep 20 '12 at 20:10
  • So what what about when process time exceeds elapsed time i.e. it is not less than or equal to elapsed time? Sep 20 '12 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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