0

I tried pprofile to profile Python code line by line.

import pprofile
profiler = pprofile.Profile()

I printed the statistics to the Ipython console using

profiler.print_stats()

This works, however, the plotted table has a lot of rows and the upper part is cut away by IPython. Since those are the data I'm interested in I need to see those. Is there any basic IPython setting that enlarges the number of rows to display? Obviously the profiler.print_stats() command can't be modified to exclude unneeded data from being displayed.

user3276418
  • 1,777
  • 4
  • 20
  • 29

1 Answers1

1

There are other methods you could call instead of print_stats(), like

profiler.dump_stats(filename)

which dumps the same output to filename. Or if you know the name of the file you are insterested in, you could call the method underlying dump_* methods:

profiler.annotate(sys.stdout, source_filename)

which dumps an annotated version of just given filename.

See the module/class documentation for more information:

help(pprofile)

vpelletier
  • 901
  • 7
  • 6