title: How to measure both CPU and GPU time taken for each line for python code?
body: <p>Below code calculates CPU time taken by entire python code. How can I extend this to each line of code and also add GPU time?</p>
  
  <pre><code>from timeit import default_timer as timer
  
  start = timer()
  # ...
  end = timer()
  print(end - start)
  </code></pre>