module cli.profile_cli

Short summary

module pyquickhelper.cli.profile_cli

Command line about transfering files.

source on GitHub

Functions

function

truncated documentation

profile_stat

Analyses the output of a profiling measured by module cProfile.

Documentation

Command line about transfering files.

source on GitHub

pyquickhelper.cli.profile_cli.profile_stat(file_stat, output=None, calls=True, verbose=False, clean_prefixes='', sort_key='line', fct_width=50, fLOG=<built-in function print>)[source]

Analyses the output of a profiling measured by module cProfile.

Parameters:
  • file_stat – filename, profiling statistics

  • output – output file, the extension determines the format, .txt for a text output, .csv for a comma separated value, .xlsx for excel output

  • calls – flat output (False) or hierchical output (True), the hierarchical output shows the call stack

  • clean_prefixes – prefixes to clean from the output, separated by ;

  • sort_keyline or cumulative or time (if calls is True)

  • fct_width – number of character dedicatedd to the function name (if calls is True)

  • verbose – more verbosity

  • fLOG – logging function

Returns:

status

Analyses profiling results produced by module cProfile

The command line produces a flat output like method print_stats or a hierchical output showing function calls.

<<<

python -m pyquickhelper profile_stat --help

>>>

usage: profile_stat [-h] [-f FILE_STAT] [-o OUTPUT] [-c CALLS] [-v VERBOSE]
                    [-cl CLEAN_PREFIXES] [-s SORT_KEY] [-fc FCT_WIDTH]

Analyses the output of a profiling measured by module :mod:`cProfile`.

optional arguments:
  -h, --help            show this help message and exit
  -f FILE_STAT, --file_stat FILE_STAT
                        filename, profiling statistics (default: None)
  -o OUTPUT, --output OUTPUT
                        output file, the extension determines the format,
                        `.txt` for a text output, `.csv` for a comma separated
                        value, `.xlsx` for excel output (default: )
  -c CALLS, --calls CALLS
                        flat output (False) or hierchical output (True), the
                        hierarchical output shows the call stack (default:
                        True)
  -v VERBOSE, --verbose VERBOSE
                        more verbosity (default: False)
  -cl CLEAN_PREFIXES, --clean_prefixes CLEAN_PREFIXES
                        prefixes to clean from the output, separated by `;`
                        (default: )
  -s SORT_KEY, --sort_key SORT_KEY
                        `line` or `cumulative` or `time` (if calls is True)
                        (default: line)
  -fc FCT_WIDTH, --fct_width FCT_WIDTH
                        number of character dedicatedd to the function name
                        (if calls is True) (default: 50)

source on GitHub