From 241c1a5459d986187ec42f166535d51b37202532 Mon Sep 17 00:00:00 2001 From: tmm1 Date: Thu, 5 Dec 2013 07:45:13 +0000 Subject: 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 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- NEWS | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'NEWS') diff --git a/NEWS b/NEWS index 8dcc979975..22a6b4735c 100644 --- a/NEWS +++ b/NEWS @@ -319,6 +319,9 @@ with all sufficient information, see the ChangeLog file. * rb_gc_count() added. This returns the number of times GC occurred. +* rb_gc_stat() added. This allows access to specific GC.stat() values from C + without any allocation overhead. + * rb_postponed_job_register() added. Takes a function callback which is invoked when the VM is in a consistent state, i.e. to perform work from a C signal handler. @@ -330,6 +333,7 @@ with all sufficient information, see the ChangeLog file. * RUBY_INTERNAL_EVENT_NEWOBJ * RUBY_INTERNAL_EVENT_FREEOBJ * RUBY_INTERNAL_EVENT_GC_START - * RUBY_INTERNAL_EVENT_GC_END + * RUBY_INTERNAL_EVENT_GC_END_MARK + * RUBY_INTERNAL_EVENT_GC_END_SWEEP * Note that you *can not* specify "internal events" with normal events (such as RUBY_EVENT_CALL, RUBY_EVENT_RETURN) simultaneously. -- cgit v1.2.3