improver.profile module

Module containing profiling utilities.

profile_hook_enable(dump_filename=None)[source]

Register a hook to gather and dump profile information at exit.

Parameters:

dump_filename (Optional[str]) – File path to dump profiling info into at exit.

Return type:

None

profile_start()[source]

Start and return a new profiler instance.

Return type:

Profile

Returns:

Active cProfile.Profile instance.

profile_stop(profiler, sort_field='cumulative', dump_filename=None, dump_line_count=100)[source]

Stop a given profiler and print or dump stats.

Parameters:
  • profiler (Profile) – Active profiling instance.

  • sort_field (str) – pstats.Stats sort field for ordering profiling results.

  • dump_filename (Optional[str]) – File path to dump profiling stats into.

  • dump_line_count (int) – Maximum lines to print out.

Return type:

None