Project

General

Profile

Bug #4991 ยป gc.c.profiler_data.patch

drbrain (Eric Hodel), 07/08/2011 09:34 AM

View differences:

gc.c (working copy)
3398 3398
}
3399 3399
#endif
3400 3400

  
3401
/*
3402
 *  call-seq:
3403
 *     GC::Profiler.data -> [Hash, ...]
3404
 *
3405
 *  Returns an Array of individual profile data Hashes ordered from earliest
3406
 *  to latest by <tt>:GC_INVOKE_TIME</tt>.  For example:
3407
 *
3408
 *    [{:GC_TIME=>1.3000000000000858e-05,
3409
 *      :GC_INVOKE_TIME=>0.010634999999999999,
3410
 *      :HEAP_USE_SIZE=>289640,
3411
 *      :HEAP_TOTAL_SIZE=>588960,
3412
 *      :HEAP_TOTAL_OBJECTS=>14724,
3413
 *      :GC_IS_MARKED=>false},
3414
 *      ...
3415
 *    ]
3416
 *
3417
 *  The keys mean:
3418
 *
3419
 *  +:GC_TIME+:: Time taken for this run in milliseconds
3420
 *  +:GC_INVOKE_TIME+:: Time the GC was invoked since startup in seconds
3421
 *  +:HEAP_USE_SIZE+:: Bytes of heap used
3422
 *  +:HEAP_TOTAL_SIZE+:: Size of heap in bytes
3423
 *  +:HEAP_TOTAL_OBJECTS+:: Number of objects
3424
 *  +:GC_IS_MARKED+:: Is the GC in the mark phase
3425
 *
3426
 */
3427

  
3401 3428
static VALUE
3402 3429
gc_profile_record_get(void)
3403 3430
{
......
3590 3617
    rb_mProfiler = rb_define_module_under(rb_mGC, "Profiler");
3591 3618
    rb_define_singleton_method(rb_mProfiler, "enabled?", gc_profile_enable_get, 0);
3592 3619
    rb_define_singleton_method(rb_mProfiler, "enable", gc_profile_enable, 0);
3620
    rb_define_singleton_method(rb_mProfiler, "data", gc_profile_record_get, 0);
3593 3621
    rb_define_singleton_method(rb_mProfiler, "disable", gc_profile_disable, 0);
3594 3622
    rb_define_singleton_method(rb_mProfiler, "clear", gc_profile_clear, 0);
3595 3623
    rb_define_singleton_method(rb_mProfiler, "result", gc_profile_result, 0);