8000 gh-96143: Improve perf profiler docs by erlend-aasland · Pull Request #96445 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-96143: Improve perf profiler docs #96445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Oct 27, 2022
Merged
Prev Previous commit
Next Next commit
Address review: add links to perf wiki, and use bullet points
  • Loading branch information
erlend-aasland committed Aug 30, 2022
commit 31c0eb819c2b951051e5cb12d497db01af28bcd4
19 changes: 11 additions & 8 deletions Doc/howto/perf_profiling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ Python support for the Linux ``perf`` profiler

:author: Pablo Galindo

The Linux ``perf`` profiler is a very powerful tool that allows you to profile and
obtain information about the performance of your application. ``perf`` also has
a very vibrant ecosystem of tools that aid with the analysis of the data that it
produces.
`The Linux perf profiler <http://perf.wiki.kernel.org>`_
is a very powerful tool that allows you to profile and obtain
information about the performance of your application.
``perf`` also has a very vibrant ecosystem of tools
that aid with the analysis of the data that it produces.

The main problem with using the ``perf`` profiler with Python applications is that
``perf`` only allows to get information about native symbols, this is, the names of
Expand Down Expand Up @@ -151,10 +152,12 @@ How to enable the ``perf`` profiling mode
-----------------------------------------

There are three ways to activate the ``perf`` profiling mode:
using the :option:`-Xperf <-X>` command-line option,
using the :envvar:`PYTHONPERFSUPPORT` environment variable,
and using the :func:`sys.activate_stack_trampoline` and
:func:`sys.deactivate_stack_trampoline` APIs.

* using the :option:`-Xperf <-X>` command-line option
* using the :envvar:`PYTHONPERFSUPPORT` environment variable
* using the :func:`sys.activate_stack_trampoline` and
:func:`sys.deactivate_stack_trampoline` APIs

If you want profiling to be active when you start the Python interpreter,
use the :option:`-Xperf <-X>` option::

Expand Down
3 changes: 2 additions & 1 deletion Doc/library/sys.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1535,7 +1535,8 @@ always available.

.. seealso::

:ref:`perf_profiling`
* :ref:`perf_profiling`
* https://perf.wiki.kernel.org

.. function:: deactivate_stack_trampoline()

Expand Down
0