Skip to content

Commit 0485922

Browse files
authored
gh-118518: Rename PYTHONPERFJITSUPPORT and -X perfjit with underscores (#118693)
1 parent 48e52fe commit 0485922

File tree

8 files changed

+20
-20
lines changed

8 files changed

+20
-20
lines changed

Doc/c-api/init_config.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -1250,10 +1250,10 @@ PyConfig
12501250
If non-zero, initialize the perf trampoline. See :ref:`perf_profiling`
12511251
for more information.
12521252
1253-
Set by :option:`-X perf <-X>` command line option and by the
1254-
:envvar:`PYTHONPERFSUPPORT` environment variable for perf support
1255-
with stack pointers and :option:`-X perfjit <-X>` command line option
1256-
and by the :envvar:`PYTHONPERFJITSUPPORT` environment variable for perf
1253+
Set by :option:`-X perf <-X>` command-line option and by the
1254+
:envvar:`PYTHON_PERF_JIT_SUPPORT` environment variable for perf support
1255+
with stack pointers and :option:`-X perf_jit <-X>` command-line option
1256+
and by the :envvar:`PYTHON_PERF_JIT_SUPPORT` environment variable for perf
12571257
support with DWARF JIT information.
12581258
12591259
Default: ``-1``.

Doc/howto/perf_profiling.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -216,19 +216,19 @@ needs to generate unwinding information for every Python function call on the fl
216216
``perf`` will take more time to process the data because it will need to use the DWARF debugging
217217
information to unwind the stack and this is a slow process.
218218

219-
To enable this mode, you can use the environment variable :envvar:`PYTHONPERFJITSUPPORT` or the
220-
:option:`-X perfjit <-X>` option, which will enable the JIT mode for the ``perf`` profiler.
219+
To enable this mode, you can use the environment variable :envvar:`PYTHON_PERF_JIT_SUPPORT` or the
220+
:option:`-X perf_jit <-X>` option, which will enable the JIT mode for the ``perf`` profiler.
221221

222222
When using the perf JIT mode, you need an extra step before you can run ``perf report``. You need to
223223
call the ``perf inject`` command to inject the JIT information into the ``perf.data`` file.
224224

225-
$ perf record -F 9999 -g --call-graph dwarf -o perf.data python -Xperfjit my_script.py
225+
$ perf record -F 9999 -g --call-graph dwarf -o perf.data python -Xperf_jit my_script.py
226226
$ perf inject -i perf.data --jit
227227
$ perf report -g -i perf.data
228228

229229
or using the environment variable::
230230

231-
$ PYTHONPERFJITSUPPORT=1 perf record -F 9999 -g --call-graph dwarf -o perf.data python my_script.py
231+
$ PYTHON_PERF_JIT_SUPPORT=1 perf record -F 9999 -g --call-graph dwarf -o perf.data python my_script.py
232232
$ perf inject -i perf.data --jit
233233
$ perf report -g -i perf.data
234234

Doc/using/cmdline.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -587,11 +587,11 @@ Miscellaneous options
587587

588588
.. versionadded:: 3.12
589589

590-
* ``-X perfjit`` enables support for the Linux ``perf`` profiler with DWARF
590+
* ``-X perf_jit`` enables support for the Linux ``perf`` profiler with DWARF
591591
support. When this option is provided, the ``perf`` profiler will be able
592-
to report Python calls using DWARF ifnormation. This option is only available on
592+
to report Python calls using DWARF information. This option is only available on
593593
some platforms and will do nothing if is not supported on the current
594-
system. The default value is "off". See also :envvar:`PYTHONPERFJITSUPPORT`
594+
system. The default value is "off". See also :envvar:`PYTHON_PERF_JIT_SUPPORT`
595595
and :ref:`perf_profiling`.
596596

597597
.. versionadded:: 3.13
@@ -1137,15 +1137,15 @@ conflict.
11371137

11381138
.. versionadded:: 3.12
11391139

1140-
.. envvar:: PYTHONPERFJITSUPPORT
1140+
.. envvar:: PYTHON_PERF_JIT_SUPPORT
11411141

11421142
If this variable is set to a nonzero value, it enables support for
11431143
the Linux ``perf`` profiler so Python calls can be detected by it
11441144
using DWARF information.
11451145

11461146
If set to ``0``, disable Linux ``perf`` profiler support.
11471147

1148-
See also the :option:`-X perfjit <-X>` command-line option
1148+
See also the :option:`-X perf_jit <-X>` command-line option
11491149
and :ref:`perf_profiling`.
11501150

11511151
.. versionadded:: 3.13

Doc/whatsnew/3.13.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ Other Language Changes
272272

273273
* Add :ref:`support for the perf profiler <perf_profiling>` working without
274274
frame pointers through the new environment variable
275-
:envvar:`PYTHONPERFJITSUPPORT` and command-line option :option:`-X perfjit
275+
:envvar:`PYTHON_PERF_JIT_SUPPORT` and command-line option :option:`-X perf_jit
276276
<-X>` (Contributed by Pablo Galindo in :gh:`118518`.)
277277

278278
* The new :envvar:`PYTHON_HISTORY` environment variable can be used to change

Lib/test/test_perf_profiler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ class TestPerfProfilerWithDwarf(unittest.TestCase, TestPerfProfilerMixin):
494494
def run_perf(self, script_dir, script, activate_trampoline=True):
495495
if activate_trampoline:
496496
return run_perf(
497-
script_dir, sys.executable, "-Xperfjit", script, use_jit=True
497+
script_dir, sys.executable, "-Xperf_jit", script, use_jit=True
498498
)
499499
return run_perf(script_dir, sys.executable, script, use_jit=True)
500500

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Allow the Linux perf support to work without frame pointers using perf's
22
advanced JIT support. The feature is activated when using the
3-
``PYTHONPERFJITSUPPORT`` environment variable or when running Python with
4-
``-Xperfjit``. Patch by Pablo Galindo
3+
``PYTHON_PERF_JIT_SUPPORT`` environment variable or when running Python with
4+
``-Xperf_jit``. Patch by Pablo Galindo.

Python/initconfig.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1703,7 +1703,7 @@ config_init_perf_profiling(PyConfig *config)
17031703
if (xoption) {
17041704
config->perf_profiling = 1;
17051705
}
1706-
env = config_get_env(config, "PYTHONPERFJITSUPPORT");
1706+
env = config_get_env(config, "PYTHON_PERF_JIT_SUPPORT");
17071707
if (env) {
17081708
if (_Py_str_to_int(env, &active) != 0) {
17091709
active = 0;
@@ -1712,7 +1712,7 @@ config_init_perf_profiling(PyConfig *config)
17121712
config->perf_profiling = 2;
17131713
}
17141714
}
1715-
xoption = config_get_xoption(config, L"perfjit");
1715+
xoption = config_get_xoption(config, L"perf_jit");
17161716
if (xoption) {
17171717
config->perf_profiling = 2;
17181718
}

Python/sysmodule.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2294,7 +2294,7 @@ sys_activate_stack_trampoline_impl(PyObject *module, const char *backend)
22942294
return NULL;
22952295
}
22962296
}
2297-
else if (strcmp(backend, "perfjit") == 0) {
2297+
else if (strcmp(backend, "perf_jit") == 0) {
22982298
_PyPerf_Callbacks cur_cb;
22992299
_PyPerfTrampoline_GetCallbacks(&cur_cb);
23002300
if (cur_cb.write_state != _Py_perfmap_jit_callbacks.write_state) {

0 commit comments

Comments
 (0)