Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions Doc/library/profile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,25 @@ The :class:`pstats.Stats` class reads profile results from a file and formats
them in various ways.

.. _profile-cli:
.. program:: cProfile

The files :mod:`cProfile` and :mod:`profile` can also be invoked as a script to
profile another script. For example::

python -m cProfile [-o output_file] [-s sort_order] (-m module | myscript.py)

``-o`` writes the profile results to a file instead of to stdout
.. option:: -o <output_file>

``-s`` specifies one of the :func:`~pstats.Stats.sort_stats` sort values to sort
the output by. This only applies when ``-o`` is not supplied.
Writes the profile results to a file instead of to stdout.

``-m`` specifies that a module is being profiled instead of a script.
.. option:: -s <sort_order>

Specifies one of the :func:`~pstats.Stats.sort_stats` sort values to sort
the output by. This only applies when ``-o`` is not supplied.

.. option:: -m <module>

Specifies that a module is being profiled instead of a script.

.. versionadded:: 3.7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, indent these values to be in -m section.

Added the ``-m`` option to :mod:`cProfile`.
Expand Down
Loading