title: How to calculate CPU utilization of a process & all its child processes in Linux?
body: <p>I want to know the CPU utilization of a process and all the child processes, for a fixed period of time, in Linux.</p>
  
  <p><em>To be more specific, here is my use-case:</em></p>
  
  <p>There is a process which waits for a request from the user to execute the programs. To execute the programs, this process invokes child processes (maximum limit of 5 at a time) &amp; each of this child process executes 1 of these submitted programs (let's say user submitted 15 programs at once). So, if user submits 15 programs, then 3 batches of 5 child processes each will run. Child processes are killed as soon as they finish their execution of the program. </p>
  
  <p>I want to know about % CPU Utilization for the parent process and all its child process during the execution of those 15 programs.</p>
  
  <p>Is there any simple way to do this using top or another command? (Or any tool i should attach to the parent process.)</p>