Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c192944

Browse filesBrowse files
miss-islingtonApostolFetpicnixzAA-Turner
authored
[3.12] gh-130160: use .. program:: directive for documenting cProfile CLI (GH-130314) (#130746)
gh-130160: use `.. program::` directive for documenting `cProfile` CLI (GH-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 c192944
Copy full SHA for c192944

File tree

1 file changed

+17
-8
lines changed
Filter options

1 file changed

+17
-8
lines changed

‎Doc/library/profile.rst

Copy file name to clipboardExpand all lines: Doc/library/profile.rst
+17-8Lines changed: 17 additions & 8 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.