Skip to content

Added scan to available PIDs in heartbeat - #16

Open
mouralucas wants to merge 10 commits into
masterfrom
CE3550
Open

Added scan to available PIDs in heartbeat#16
mouralucas wants to merge 10 commits into
masterfrom
CE3550

Conversation

@mouralucas

Copy link
Copy Markdown

This PR aims to add a scan to find PIDs available to profile in all languages.
This found PIDs are sent to the backend through heartbeat call.

I was also added the documentation about POST PROFILE FILTERING for the available languages.

Checklist:

  • I have read the CONTRIBUTING document.
  • I have updated the relevant documentation.
  • [] I have added tests for new logic.

… list to backend through heartbeat call

Added readme about the post profiling filtering
Fix example code to run heartbeat mode profiling
@mouralucas
mouralucas marked this pull request as ready for review September 3, 2025 18:21
Comment thread docs/HEARTBEAT_SYSTEM_README.md
Comment thread docs/POST_PROFILING_FILTERING.md Outdated
|----------|----------|----------|
| **🐍 Python eBPF** | `python_ebpf.py:355-357` | PyPerf profiles ALL Python processes system-wide, then filters results |
| **🐘 PHP** | `php.py:211-213` | phpspy profiles detected PHP processes, then filters output |
| **⚡ System/perf** | `perf.py:200,216,232` | perf runs system-wide collection, may use some targeting |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we improved this behavior to defer perf to start method, you probably want to rebase master and re-generate this read me ( using cursor)

Comment thread gprofiler/heartbeat.py
from granulate_utils.python import DETECTED_PYTHON_PROCESSES_REGEX

# Define profiler patterns
profiler_patterns = {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will miss out process of C/C++ and Go which are triggered by perf. If you go with perf profiler pattern, it will select 1k+ process ids which is huge.

So I would suggest fetching just top 50 pids by cpu. You can rebase master and probably ask cursor : since this logic exists to fetch by top N cpu bound processes. you probably can reuse max_processes_per_profiler for this , change default to 50

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mouralucas : happy to discuss on this requirement for C/C++, Go and NodeJs

Comment thread gprofiler/heartbeat.py
from granulate_utils.python import DETECTED_PYTHON_PROCESSES_REGEX

# Define profiler patterns
profiler_patterns = {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mouralucas : happy to discuss on this requirement for C/C++, Go and NodeJs

Comment thread gprofiler/main.py
dest="max_processes_per_profiler",
type=positive_integer,
default=0,
default=50,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @mouralucas for reusing this parameter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants