path: root/include
diff options
authortmm1 <tmm1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-05 07:45:13 +0000
committertmm1 <tmm1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-05 07:45:13 +0000
commit241c1a5459d986187ec42f166535d51b37202532 (patch)
tree27e697e24d024fab3242323d01e8644ee164e61d /include
parent97ac1f6767745e97b136f9f0e1afd56903723f1a (diff)
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:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include')
1 files changed, 1 insertions, 0 deletions
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index c1114ae..cc13557 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -486,6 +486,7 @@ DEPRECATED(void rb_gc_set_params(void));
VALUE rb_define_finalizer(VALUE, VALUE);
VALUE rb_undefine_finalizer(VALUE);
size_t rb_gc_count(void);
+size_t rb_gc_stat(VALUE);
/* hash.c */
void st_foreach_safe(struct st_table *, int (*)(ANYARGS), st_data_t);
VALUE rb_check_hash_type(VALUE);