Bug #5292

Access to GC::Profiler Records

Added by Charlie Savage over 5 years ago. Updated about 5 years ago.

ruby -v:
ruby 1.9.3dev (2011-09-02 revision 33163) [i386-mswin32_100]


Could the method gc_profile_record_get be made part of the GC::Profiler class? It returns an array of hashes of various interesting GC measurements.

I'd like ruby-prof to hook into it. Unfortunately, only textual output is currently supported via gc_profile_result. And parsing that output would be a pain.

To do this:

  • 1 line patch to gcc.c:

rb_define_singleton_method(rb_mProfiler, "records", gc_profile_record_get, 0);

  • Is is a safe change since the result is a newly created array of hashes each time.

  • Its useful for performance analysis tools (like ruby-prof)

Would be great to have this in 1.9.3 if at all possible.

Thanks - Charlie

Related issues

Duplicates Ruby trunk - Bug #4991: Add a method to retrieve raw data from GC::Profiler Closed 07/08/2011


#1 [ruby-core:39330] Updated by Charlie Savage over 5 years ago

Sorry - I missed that there was already a request for this two months ago - see #4991. It includes the 1 line patch as well as documentation.

Could it be applied?

#2 Updated by Narihiro Nakamura over 5 years ago

  • Status changed from Open to Closed

This issue was solved with changeset r33224.
Eric, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

  • gc.c (Init_GC): defined GC::Profiler.raw_data. based on the patch by Eric Hodel. [Bug #4991]

#3 [ruby-core:39372] Updated by Charlie Savage about 5 years ago

Thank you.

Can this be part of 1.9.3 or is it too late?


#4 [ruby-core:39417] Updated by Narihiro Nakamura about 5 years ago

Charlie Savage wrote:

Thank you.

Can this be part of 1.9.3 or is it too late?


Sorry, it's too late, because 1.9.3 branch already in feature freeze.

Also available in: Atom PDF