[ruby-cvs:51150] tmm1:r44005 (trunk): gc.c: expose GC.stat() to C-api via rb_gc_stat()

tmm1 at ruby-lang.org tmm1 at ruby-lang.org
Thu Dec 5 16:45:14 JST 2013


tmm1	2013-12-05 16:45:13 +0900 (Thu, 05 Dec 2013)

  New Revision: 44005

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44005

  Log:
    gc.c: expose GC.stat() to C-api via rb_gc_stat()
    
    * include/ruby/intern.h: add rb_gc_stat() for access to GC.stat
      variables from c-api
    * gc.c (rb_gc_stat): new c-api method. accepts either VALUE hash like
      GC.stat, or VALUE symbol key and returns size_t directly. the second
      form is useful to avoid allocations, i.e. for usage inside
      INTERNAL_EVENT_GC tracepoints.
    * gc.c (gc_stat): add GC.stat(:key) to return single value instead of hash
    * gc.c (gc_stat_internal): helper method to retrieve single or all stat values
    * test/ruby/test_gc.rb (class TestGc): test for new behavior
    * NEWS: note about this new api

  Modified files:
    trunk/ChangeLog
    trunk/NEWS
    trunk/gc.c
    trunk/include/ruby/intern.h
    trunk/test/ruby/test_gc.rb


More information about the ruby-cvs mailing list