gh-130160: use .. program::
directive for documenting cProfile
CLI (#130314)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This commit is contained in:
parent
a98a6bd112
commit
5181ddb29f
@ -123,23 +123,32 @@ them in various ways.
|
|||||||
|
|
||||||
.. _profile-cli:
|
.. _profile-cli:
|
||||||
|
|
||||||
|
.. program:: cProfile
|
||||||
|
|
||||||
The files :mod:`cProfile` and :mod:`profile` can also be invoked as a script to
|
The files :mod:`cProfile` and :mod:`profile` can also be invoked as a script to
|
||||||
profile another script. For example::
|
profile another script. For example::
|
||||||
|
|
||||||
python -m cProfile [-o output_file] [-s sort_order] (-m module | myscript.py)
|
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
|
Writes the profile results to a file instead of to stdout.
|
||||||
the output by. This only applies when ``-o`` is not supplied.
|
|
||||||
|
|
||||||
``-m`` specifies that a module is being profiled instead of a script.
|
.. option:: -s <sort_order>
|
||||||
|
|
||||||
.. versionadded:: 3.7
|
Specifies one of the :func:`~pstats.Stats.sort_stats` sort values
|
||||||
Added the ``-m`` option to :mod:`cProfile`.
|
to sort the output by.
|
||||||
|
This only applies when :option:`-o <cProfile -o>` is not supplied.
|
||||||
|
|
||||||
.. versionadded:: 3.8
|
.. option:: -m <module>
|
||||||
Added the ``-m`` option to :mod:`profile`.
|
|
||||||
|
Specifies that a module is being profiled instead of a script.
|
||||||
|
|
||||||
|
.. versionadded:: 3.7
|
||||||
|
Added the ``-m`` option to :mod:`cProfile`.
|
||||||
|
|
||||||
|
.. versionadded:: 3.8
|
||||||
|
Added the ``-m`` option to :mod:`profile`.
|
||||||
|
|
||||||
The :mod:`pstats` module's :class:`~pstats.Stats` class has a variety of methods
|
The :mod:`pstats` module's :class:`~pstats.Stats` class has a variety of methods
|
||||||
for manipulating and printing the data saved into a profile results file::
|
for manipulating and printing the data saved into a profile results file::
|
||||||
|
Loading…
x
Reference in New Issue
Block a user