Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ For each profiling session (each profiling duration), gProfiler produces outputs
* `--python-mode`: Controls which profiler is used for Python.
* `auto` - (default) try with PyPerf (eBPF), fall back to py-spy.
* `pyperf` - Use PyPerf with no py-spy fallback.
* `pyspy` - Use py-spy.
* `pyspy`/`py-spy` - Use py-spy.
* `disabled` - Disable profilers for Python.

Profiling using eBPF incurs lower overhead & provides kernel stacks. This (currently) requires kernel headers to be installed.
Expand Down
6 changes: 5 additions & 1 deletion gprofiler/profilers/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ def stop(self):

@register_profiler(
"Python",
possible_modes=["auto", "pyperf", "pyspy", "disabled"],
# py-spy is like pyspy, it's confusing and I mix between them
possible_modes=["auto", "pyperf", "pyspy", "py-spy", "disabled"],
default_mode="auto",
# we build pyspy for both, pyperf only for x86_64.
# TODO: this inconsistency shows that py-spy and pyperf should have different Profiler classes,
Expand Down Expand Up @@ -317,6 +318,9 @@ def __init__(
python_mode: str,
python_pyperf_user_stacks_pages: Optional[int],
):
if python_mode == "py-spy":
python_mode = "pyspy"

assert python_mode in ("auto", "pyperf", "pyspy"), f"unexpected mode: {python_mode}"

if get_arch() != "x86_64":
Expand Down