mprofile#

mprofile(run, follow=None, show_results=True, *args, **kwargs)[source]#

Profile the line-by-line memory required by a function. See profile() for a usage example.

Parameters:
  • run (function) – The function to be run

  • follow (function) – The function or list of functions to be followed in the profiler; if None, defaults to the run function

  • show_results (bool) – whether to print the statistics of the profile to stdout

  • args – Passed to the function to be run

  • kwargs – Passed to the function to be run

Returns:

LineProfiler (by default, the profile output is also printed to stdout)