title: Using vmprof from within script
body: <p>To profile a function one can use:</p>
  
  <pre><code>import cProfile
  print cProfile.run('foo()')
  </code></pre>
  
  <p>Is it possible to use <a href="http://vmprof.readthedocs.io/" rel="nofollow">vmprof</a> in similar way, i.e. just to profile one function from within the code? I'm asking because the linked docs only shows how to run it from command line:</p>
  
  <pre><code>python -m vmprof &lt;program.py&gt; &lt;program parameters&gt;
  </code></pre>