@@ -123,23 +123,32 @@ them in various ways.
123
123
124
124
.. _profile-cli :
125
125
126
+ ..program ::cProfile
127
+
126
128
The files:mod: `cProfile ` and:mod: `profile ` can also be invoked as a script to
127
129
profile another script. For example::
128
130
129
131
python -m cProfile [-o output_file] [-s sort_order] (-m module | myscript.py)
130
132
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.
132
142
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 >
135
144
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.
137
146
138
- ..versionadded ::3.7
139
- Added the ``-m `` option to:mod: `cProfile `.
147
+ ..versionadded ::3.7
148
+ Added the ``-m `` option to:mod: `cProfile `.
140
149
141
- ..versionadded ::3.8
142
- Added the ``-m `` option to:mod: `profile `.
150
+ ..versionadded ::3.8
151
+ Added the ``-m `` option to:mod: `profile `.
143
152
144
153
The:mod: `pstats ` module's:class: `~pstats.Stats ` class has a variety of methods
145
154
for manipulating and printing the data saved into a profile results file::