Skip to content

Refactor py-spy & pyperf to separate ProfilerInterface classes #500

Open
@Jongy

Description

@Jongy

We have PythonProfiler which is a class that hides the fact that we have 2 profiler types behind - py-spy or pyperf, and decides itself which one is used.

The decision needs to move out, and each of py-spy & pyperf should implement the interface and be registered separately. This way they can have different settings in their register_profiler decorator, as suggested here: https://github.com/Granulate/gprofiler/blob/4bcb3aedae1c286d3058a0dc0f559cf88fe5e940/gprofiler/profilers/python.py#L279

This also removes the need for the PythonProfiler itself (which directs calls at the different underlying classes).

Instead, for each "runtime" such as "python", we'll have a function select_profiler that gets the mode requested by the user and the list of available profilers (given the architecture & platform) and will run the necessary tests to decide (what is currently implemented in PythonEbpfProfiler.test)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions