Use :option:`--no-summary` to suppress both the legend and summary sections.
-To save pstats output to a file instead of stdout::
+To save pstats output to a binary file instead of stdout::
- python -m profiling.sampling run -o profile.txt script.py
+ python -m profiling.sampling run -o profile.pstats script.py
The pstats format supports several options for controlling the display.
The :option:`--sort` option determines the column used for ordering results::
.. option:: --pstats
- Generate text statistics output. This is the default.
+ Generate pstats statistics. This is the default.
+ When written to stdout, the output is a text table; with :option:`-o`,
+ it is a binary pstats file.
.. option:: --collapsed
.. option:: -o <path>, --output <path>
Output file or directory path. Default behavior varies by format:
- :option:`--pstats` writes to stdout, while other formats generate a file
- named ``<format>_<PID>.<ext>`` (for example, ``flamegraph_12345.html``).
+ :option:`--pstats` prints a text table to stdout, while ``-o`` writes a
+ binary pstats file. Other formats generate a file named
+ ``<format>_<PID>.<ext>`` (for example, ``flamegraph_12345.html``).
:option:`--heatmap` creates a directory named ``heatmap_<PID>``.
.. option:: --browser
"-o",
"--output",
dest="outfile",
- help="Output path (default: stdout for pstats, auto-generated for others). "
- "For heatmap: directory name (default: heatmap_PID)",
+ help="Output path (default: stdout for pstats text; with -o, pstats is binary). "
+ "Auto-generated for other formats. For heatmap: directory name (default: heatmap_PID)",
)
output_group.add_argument(
"--browser",