Skip to content

Lack of perf support on Alpine Linux #152769

Description

@weixlu

Feature or enhancement

Proposal:

The Python documentation for perf profiling mentions that, users can enable -X perf to collect Python function-level hotspot information.

However, this feature is not currently available on Alpine Linux(musl libc).

For example, if I collect and inspect profiling data for demo.py with the following commands:

perf record -F 999 -g --call-graph fp -o /tmp/perf.data ./python -X perf demo.py
perf report -i /tmp/perf.data --stdio

I do not see any Python functions in the report. Instead, I only see _PyEval_EvalFrameDefault.

In addition, the profiling-related tests are skipped on Alpine, including test_perf_profiler, test_perfmaps, test_samply_profiler, with this message: perf trampoline profiling not supported.

However, trampoline profiling is CPU-architecture-specific, not related to platform or libc. Simply reusing the existing glibc trampoline implementation appears to work correctly on Alpine as well. I am going to open a PR to for this.

Has this already been discussed elsewhere?

I have already discussed this feature proposal on Discourse

Links to previous discussion of this feature:

https://discuss.python.org/t/the-python-test-suite-now-pass-on-alpine-linux-musl-c-library/107792/3

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions