@@ -15,9 +15,9 @@ information about the performance of your application.
1515that aid with the analysis of the data that it produces.
1616
1717The main problem with using the ``perf `` profiler with Python applications is that
18- ``perf `` only allows to get information about native symbols, this is, the names of
19- the functions and procedures written in C. This means that the names and file names
20- of the Python functions in your code will not appear in the output of the ``perf ``.
18+ ``perf `` only gets information about native symbols, that is, the names of
19+ functions and procedures written in C. This means that the names and file names
20+ of Python functions in your code will not appear in the output of ``perf ``.
2121
2222Since Python 3.12, the interpreter can run in a special mode that allows Python
2323functions to appear in the output of the ``perf `` profiler. When this mode is
@@ -28,8 +28,8 @@ relationship between this piece of code and the associated Python function using
2828
2929.. note ::
3030
31- Support for the ``perf `` profiler is only currently available for Linux on
32- selected architectures. Check the output of the configure build step or
31+ Support for the ``perf `` profiler is currently only available for Linux on
32+ select architectures. Check the output of the `` configure `` build step or
3333 check the output of ``python -m sysconfig | grep HAVE_PERF_TRAMPOLINE ``
3434 to see if your system is supported.
3535
@@ -52,11 +52,11 @@ For example, consider the following script:
5252 if __name__ == " __main__" :
5353 baz(1000000 )
5454
55- We can run ``perf `` to sample CPU stack traces at 9999 Hertz ::
55+ We can run ``perf `` to sample CPU stack traces at 9999 hertz ::
5656
5757 $ perf record -F 9999 -g -o perf.data python my_script.py
5858
59- Then we can use ``perf `` report to analyze the data:
59+ Then we can use ``perf report `` to analyze the data:
6060
6161.. code-block :: shell-session
6262
@@ -97,7 +97,7 @@ Then we can use ``perf`` report to analyze the data:
9797 | | | | | |--2.97%--_PyObject_Malloc
9898 ...
9999
100- As you can see here , the Python functions are not shown in the output, only ``_Py_Eval_EvalFrameDefault `` appears
100+ As you can see, the Python functions are not shown in the output, only ``_Py_Eval_EvalFrameDefault ``
101101(the function that evaluates the Python bytecode) shows up. Unfortunately that's not very useful because all Python
102102functions use the same C function to evaluate bytecode so we cannot know which Python function corresponds to which
103103bytecode-evaluating function.
@@ -151,7 +151,7 @@ Instead, if we run the same experiment with ``perf`` support enabled we get:
151151 How to enable ``perf `` profiling support
152152----------------------------------------
153153
154- ``perf `` profiling support can either be enabled from the start using
154+ ``perf `` profiling support can be enabled either from the start using
155155the environment variable :envvar: `PYTHONPERFSUPPORT ` or the
156156:option: `-X perf <-X> ` option,
157157or dynamically using :func: `sys.activate_stack_trampoline ` and
@@ -192,7 +192,7 @@ Example, using the :mod:`sys` APIs in file :file:`example.py`:
192192How to obtain the best results
193193------------------------------
194194
195- For the best results, Python should be compiled with
195+ For best results, Python should be compiled with
196196``CFLAGS="-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" `` as this allows
197197profilers to unwind using only the frame pointer and not on DWARF debug
198198information. This is because as the code that is interposed to allow ``perf ``
0 commit comments