From e4c58251b736ba362774b24787dff672fd3ee41b Mon Sep 17 00:00:00 2001 From: ko1 Date: Mon, 27 May 2013 15:40:27 +0000 Subject: * include/ruby/ruby.h, gc.c: add new internal event RUBY_INTERNAL_EVENT_GC_END. This event invokes at the end of after_sweep(). Time chart with lazy sweep is here: (1) Kick RUBY_INTERNAL_EVENT_GC_START (2) [gc_marks()] (3) [lazy_sweep()] (4) [... run Ruby program (mutator) with lazy_sweep() ...] (5) [after_sweep()] (6) Kick RUBY_INTERNAL_EVENT_GC_END (7) [... run Ruby program (mutator), and go to (1) ...] * ext/-test-/tracepoint/tracepoint.c, test/-ext-/tracepoint/test_tracepoint.rb: modify a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/-test-/tracepoint/tracepoint.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'ext/-test-') diff --git a/ext/-test-/tracepoint/tracepoint.c b/ext/-test-/tracepoint/tracepoint.c index 8164a633eb..2710f51747 100644 --- a/ext/-test-/tracepoint/tracepoint.c +++ b/ext/-test-/tracepoint/tracepoint.c @@ -4,6 +4,7 @@ static size_t newobj_count; static size_t free_count; static size_t gc_start_count; +static size_t gc_end_count; static size_t objects_count; static VALUE objects[10]; @@ -29,6 +30,11 @@ tracepoint_track_objspace_events_i(VALUE tpval, void *data) gc_start_count++; break; } + case RUBY_INTERNAL_EVENT_GC_END: + { + gc_end_count++; + break; + } default: rb_raise(rb_eRuntimeError, "unknown event"); } @@ -37,7 +43,9 @@ tracepoint_track_objspace_events_i(VALUE tpval, void *data) VALUE tracepoint_track_objspace_events(VALUE self) { - VALUE tpval = rb_tracepoint_new(0, RUBY_INTERNAL_EVENT_NEWOBJ | RUBY_INTERNAL_EVENT_FREEOBJ | RUBY_INTERNAL_EVENT_GC_START, tracepoint_track_objspace_events_i, 0); + VALUE tpval = rb_tracepoint_new(0, RUBY_INTERNAL_EVENT_NEWOBJ | RUBY_INTERNAL_EVENT_FREEOBJ | + RUBY_INTERNAL_EVENT_GC_START | RUBY_INTERNAL_EVENT_GC_END, + tracepoint_track_objspace_events_i, 0); VALUE result = rb_ary_new(); int i; @@ -50,6 +58,7 @@ tracepoint_track_objspace_events(VALUE self) rb_ary_push(result, SIZET2NUM(newobj_count)); rb_ary_push(result, SIZET2NUM(free_count)); rb_ary_push(result, SIZET2NUM(gc_start_count)); + rb_ary_push(result, SIZET2NUM(gc_end_count)); for (i=0; i