diff options
| author | nari <nari@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-09-08 03:57:41 +0000 |
|---|---|---|
| committer | nari <nari@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-09-08 03:57:41 +0000 |
| commit | 599071b700aa7176a2bb762c2d9781d02013f27c (patch) | |
| tree | d9edd11af8273e8c6b668979fdf9478be2bd909a | |
| parent | f1cdbd7bc8dc42c38b00bbff06dcdb9c03621b49 (diff) | |
* gc.c (Init_GC): defined GC::Profiler.raw_data. based on the
patch by Eric Hodel. [ruby-core:37857] [Bug #4991]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | gc.c | 28 |
2 files changed, 33 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Thu Sep 8 12:43:18 2011 Narihiro Nakamura <authornari@gmail.com> + + * gc.c (Init_GC): defined GC::Profiler.raw_data. based on the + patch by Eric Hodel. [ruby-core:37857] [Bug #4991] + Thu Sep 8 09:02:53 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> * gc.c (id2ref): objects which are unmarked but not in sweep_slots @@ -3434,6 +3434,33 @@ gc_malloc_allocations(VALUE self) } #endif +/* + * call-seq: + * GC::Profiler.raw_data -> [Hash, ...] + * + * Returns an Array of individual raw profile data Hashes ordered + * from earliest to latest by <tt>:GC_INVOKE_TIME</tt>. For example: + * + * [{:GC_TIME=>1.3000000000000858e-05, + * :GC_INVOKE_TIME=>0.010634999999999999, + * :HEAP_USE_SIZE=>289640, + * :HEAP_TOTAL_SIZE=>588960, + * :HEAP_TOTAL_OBJECTS=>14724, + * :GC_IS_MARKED=>false}, + * ... + * ] + * + * The keys mean: + * + * +:GC_TIME+:: Time taken for this run in milliseconds + * +:GC_INVOKE_TIME+:: Time the GC was invoked since startup in seconds + * +:HEAP_USE_SIZE+:: Bytes of heap used + * +:HEAP_TOTAL_SIZE+:: Size of heap in bytes + * +:HEAP_TOTAL_OBJECTS+:: Number of objects + * +:GC_IS_MARKED+:: Is the GC in the mark phase + * + */ + static VALUE gc_profile_record_get(void) { @@ -3626,6 +3653,7 @@ Init_GC(void) rb_mProfiler = rb_define_module_under(rb_mGC, "Profiler"); rb_define_singleton_method(rb_mProfiler, "enabled?", gc_profile_enable_get, 0); rb_define_singleton_method(rb_mProfiler, "enable", gc_profile_enable, 0); + rb_define_singleton_method(rb_mProfiler, "raw_data", gc_profile_record_get, 0); rb_define_singleton_method(rb_mProfiler, "disable", gc_profile_disable, 0); rb_define_singleton_method(rb_mProfiler, "clear", gc_profile_clear, 0); rb_define_singleton_method(rb_mProfiler, "result", gc_profile_result, 0); |
