1

What all factors are important when measuring CPU time for a process?

I am not interested in How to measure CPU time as it will largely depend on the Operating System. But I want to know if I have to measure the CPU time for a process what all different times should be summed up to report the total CPU time taken by a process which remain independent of OS.

I can imagine it will have to be a sum of actual CPU time taken in executing instructions ( User mode as well as Kernel mode) but also Context Switching time , I/O time etc. What all these factors are? A small explanation on each factor would also be very helpful. For example, when CPU switches from process p1 to p2, in which process bucket 'time taken to switch' is accounted for ?

ViFI
  • 971
  • 1
  • 11
  • 27
  • Could you please provide more details? For example, your "time taken to switch" bucket or rather the context switch bucket can be further broken down into smaller components. – babon Jun 26 '16 at 14:16
  • @babon : Question is actually to look for those details at top level and if possible at smaller components level as well. – ViFI Jun 27 '16 at 02:07

1 Answers1

0

"User time" refers to the amount of CPU time a process spends executing in user space. This includes your code and all the user space code that it executes, e.g. libraries. "Kernel" or "system" time refers to the time the processor spends in the kernel doing things like handling interrupts, task scheduling, swapping, etc. I think what you want is "User time".

You cannot, to my knowledge, identify the CPU cycles spent in the kernel that are specific to executing functions for a given process.

"User time" is usually expressed as a % of the total CPU time.

Taylor Kidd
  • 1,463
  • 1
  • 9
  • 11