title: Will time.process_time() sum all CPU times from subprocess?
body: <p>I want to find a way to get accumulated CPU times of all subprocess in python, I tried time.process_time() in the following code:</p>
  <pre><code>import multiprocessing
  import time
  import sklearn
  from sklearn import datasets
  
  
  def sub_process():
      t0 = time.time()
      t1 = time.process_time()
      x = 0
      for i in range(1000000000):
          x+=i
      print(time.time()-t0)
      print(time.process_time()-t1)
  
  def main_process():
      process_list = []
      for _ in range(2):
          tmp_process = multiprocessing.Process(target=sub_process)
          process_list.append(tmp_process)
      for process in process_list:
          process.start()
      for process in process_list:
          process.join()
  
  main_t_0 = time.time()
  main_t_1 = time.process_time()
  main_process()
  print(time.time()-main_t_0)
  print(time.process_time()-main_t_1)
  </code></pre>
  <p>And got the following result:</p>
  <p>60.51823401451111</p>
  <p>60.518644068</p>
  <p>61.03675556182861</p>
  <p>61.037412923</p>
  <p>61.048630237579346</p>
  <p>0.00870562100000001</p>
  <p>which indicates that time.process_time() does not contain the processing time used by sub_process. However, if I tried the following code:</p>
  <pre><code>import multiprocessing
  import time
  import sklearn
  from sklearn import datasets
  
  main_t_0 = time.time()
  main_t_1 = time.process_time()
  A = datasets.make_spd_matrix(10000)
  print(time.time()-main_t_0)
  print(time.process_time()-main_t_1)
  </code></pre>
  <p>The result would be:</p>
  <p>185.01790952682495</p>
  <p>3086.4627873910003</p>
  <p>I can see from the terminal that when running datasets.make_spd_matrix, there also exist several subprocess, but this time, time.process_time() seems to sum their CPU time all up. Could someone tell me why these two cases are different?</p>