title: How do I use line_profiler (from Robert Kern)?
body: <p>I have tried using the line_profiler module for getting a line-by-line profile over a Python file. This is what I've done so far:</p>
  
  <p>1) Installed line_profiler from <a href="https://pypi.python.org/pypi/line_profiler" rel="noreferrer">pypi</a> by using the .exe file (I am on WinXP and Win7). Just clicked through the installation wizard.</p>
  
  <p>2) Written a small piece of code (similar to what has been asked in another answered question <a href="https://stackoverflow.com/questions/22328183/python-line-profiler-code-example">here</a>).</p>
  
  <pre><code>from line_profiler import LineProfiler
  def do_stuff(numbers):
      print numbers
  
  numbers = 2
  profile = LineProfiler(do_stuff(numbers))
  profile.print_stats()
  </code></pre>
  
  <p>3) Run the code from IDLE/PyScripter. I got only the time. </p>
  
  <pre><code>Timer unit: 4.17188e-10 s
  </code></pre>
  
  <p>How do I get full line-by-line profile over the code I execute? I have never used any advanced Python features like decorators, so it is hard for me to understand how shall I use the guidelines provided by several posts like <a href="https://web.archive.org/web/20140513005858im_/http://www.appneta.com/blog/line-profiler-python/" rel="noreferrer">here</a> and <a href="http://www.huyng.com/posts/python-performance-analysis/" rel="noreferrer">here</a>.</p>