Skip to content

Commit b1e98ab

Browse files
ApostolFetpicnixzAA-Turner
authored andcommitted
pythongh-130160: use .. program:: directive for documenting cProfile CLI (pythonGH-130314)
(cherry picked from commit 5181ddb) Co-authored-by: Apostol Fet <90645107+ApostolFet@users.noreply.github.com> 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>
1 parent 0860d9c commit b1e98ab

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

Doc/library/profile.rst

+17-8
Original file line numberDiff line numberDiff line change
@@ -123,23 +123,32 @@ them in various ways.
123123

124124
.. _profile-cli:
125125

126+
.. program:: cProfile
127+
126128
The files :mod:`cProfile` and :mod:`profile` can also be invoked as a script to
127129
profile another script. For example::
128130

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

131-
``-o`` writes the profile results to a file instead of to stdout
133+
.. option:: -o <output_file>
134+
135+
Writes the profile results to a file instead of to stdout.
136+
137+
.. option:: -s <sort_order>
138+
139+
Specifies one of the :func:`~pstats.Stats.sort_stats` sort values
140+
to sort the output by.
141+
This only applies when :option:`-o <cProfile -o>` is not supplied.
132142

133-
``-s`` specifies one of the :func:`~pstats.Stats.sort_stats` sort values to sort
134-
the output by. This only applies when ``-o`` is not supplied.
143+
.. option:: -m <module>
135144

136-
``-m`` specifies that a module is being profiled instead of a script.
145+
Specifies that a module is being profiled instead of a script.
137146

138-
.. versionadded:: 3.7
139-
Added the ``-m`` option to :mod:`cProfile`.
147+
.. versionadded:: 3.7
148+
Added the ``-m`` option to :mod:`cProfile`.
140149

141-
.. versionadded:: 3.8
142-
Added the ``-m`` option to :mod:`profile`.
150+
.. versionadded:: 3.8
151+
Added the ``-m`` option to :mod:`profile`.
143152

144153
The :mod:`pstats` module's :class:`~pstats.Stats` class has a variety of methods
145154
for manipulating and printing the data saved into a profile results file::

0 commit comments

Comments
 (0)