25.10.1 Command Line Usage
The trace module can be invoked from the command line. It can be as simple as
python -m trace --count somefile.py ...
The above will generate annotated listings of all Python modules imported during the execution of somefile.py.
The following command-line arguments are supported:
- Display lines as they are executed.
- Produce a set of annotated listing files upon program
completion that shows how many times each statement was executed.
- Produce an annotated list from an earlier program run that
used the --count and --file arguments.
- Do not generate annotated listings. This is useful if you intend to make
several runs with --count then produce a single set
of annotated listings at the end.
- List the functions executed by running the program.
- Generate calling relationships exposed by running the program.
- Name a file containing (or to contain) counts.
- Name a directory in which to save annotated listing files.
- When generating annotated listings, mark lines which
were not executed with `
>>>>>>
'. - When using --count or --report, write a
brief summary to stdout for each file processed.
- Ignore the named module and its submodules (if it is
a package). May be given multiple times.
- Ignore all modules and packages in the named directory and subdirectories. May be given multiple times.
See About this document... for information on suggesting changes.