Project

General

Profile

Actions

Feature #10602

open

Support multithreaded profiling

Added by mperham (Mike Perham) almost 7 years ago. Updated about 2 years ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:66863]

Description

The current rb_profile_frames captures the frame for whatever thread is current. This makes profiling a multithreaded system impossible. I'd like a rb_thread_profile_frames which captures a given thread. It seems like it would be a very simple change, something like this:

int
rb_profile_frames(int start, int limit, VALUE *buff, int *lines)
{
    rb_profile_frames(start, limit, buff, lines, GET_THREAD())
}

int
rb_thread_profile_frames(int start, int limit, VALUE *buff, int *lines, rb_thread_t *th)
{
    int i;
    rb_control_frame_t *cfp = th->cfp, *end_cfp = RUBY_VM_END_CONTROL_FRAME(th);
    ...

This way profiling gems could lock to a specific thread.

Updated by mperham (Mike Perham) almost 7 years ago

To be clear, I want to profile a single thread within a running multithreaded Ruby app. This is useful for profiling individual Sidekiq jobs executing in production. Right now the profile frames capture data from other threads which makes the output useless.

Actions #2

Updated by jeremyevans0 (Jeremy Evans) about 2 years ago

  • Backport deleted (2.0.0: UNKNOWN, 2.1: UNKNOWN)
  • ruby -v deleted (2.1.5)
  • Tracker changed from Bug to Feature
Actions

Also available in: Atom PDF