intel / intel/gprofiler

Refactor py-spy & pyperf to separate ProfilerInterface classes

Open
#500 4 comments 0 reactions 1 assignee Claimed by @marcin-ol View on GitHub
defined-and-prioritized refactor runtime/python
Dominant language
Python
Stars
826
Forks
79
PR merge metrics
No merged PRs in 30d

Description

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`)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.