ruby-changes:28824
From: ko1 <ko1@a...>
Date: Tue, 21 May 2013 16:52:14 +0900 (JST)
Subject: [ruby-changes:28824] ko1:r40876 (trunk): * gc.c: GC::Profiler's sweeping time is accumulated all slot
ko1 2013-05-21 16:52:03 +0900 (Tue, 21 May 2013) New Revision: 40876 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40876 Log: * gc.c: GC::Profiler's sweeping time is accumulated all slot sweeping time. At lazy GC, GC::Profiler makes new record entry for each lazy_sweep(). In this change, accumulating all slot_sweep() time. And change indentation. Modified files: trunk/ChangeLog trunk/gc.c Index: ChangeLog =================================================================== --- ChangeLog (revision 40875) +++ ChangeLog (revision 40876) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue May 21 16:45:31 2013 Koichi Sasada <ko1@a...> + + * gc.c: GC::Profiler's sweeping time is accumulated all slot + sweeping time. At lazy GC, GC::Profiler makes new record entry + for each lazy_sweep(). In this change, accumulating all + slot_sweep() time. + And change indentation. + Tue May 21 16:29:09 2013 Koichi Sasada <ko1@a...> * common.mk (rdoc-bench): add a benchmark rule Index: gc.c =================================================================== --- gc.c (revision 40875) +++ gc.c (revision 40876) @@ -2171,18 +2171,18 @@ static void https://github.com/ruby/ruby/blob/trunk/gc.c#L2171 slot_sweep(rb_objspace_t *objspace, struct heaps_slot *sweep_slot) { gc_prof_sweep_slot_timer_start(objspace); - + { #if USE_RGENGC - if (objspace->rgengc.during_minor_gc) { - slot_sweep_minor(objspace, sweep_slot); - } - else { - slot_sweep_major(objspace, sweep_slot); - } + if (objspace->rgengc.during_minor_gc) { + slot_sweep_minor(objspace, sweep_slot); + } + else { + slot_sweep_major(objspace, sweep_slot); + } #else - slot_sweep_body(objspace, sweep_slot, FALSE); + slot_sweep_body(objspace, sweep_slot, FALSE); #endif - + } gc_prof_sweep_slot_timer_stop(objspace); } @@ -2313,13 +2313,10 @@ gc_prepare_free_objects(rb_objspace_t *o https://github.com/ruby/ruby/blob/trunk/gc.c#L2313 if (!ready_to_gc(objspace)) return TRUE; during_gc++; - gc_prof_timer_start(objspace); if (objspace->heap.sweep_slots) { res = lazy_sweep(objspace); if (res) { - gc_prof_set_malloc_info(objspace); - gc_prof_timer_stop(objspace, Qfalse); return res; } } @@ -2330,27 +2327,28 @@ gc_prepare_free_objects(rb_objspace_t *o https://github.com/ruby/ruby/blob/trunk/gc.c#L2327 } } - gc_marks(objspace, TRUE); + gc_prof_timer_start(objspace); + { + gc_marks(objspace, TRUE); + + before_gc_sweep(objspace); + if (!(res = lazy_sweep(objspace))) { + /* there is no freespace after slot_sweep() */ + while (1) { + /* There is no empty RVALUE spaces */ + /* TODO: [RGENGC] Should do major GC before adding hepas */ - before_gc_sweep(objspace); + set_heaps_increment(objspace); + heaps_increment(objspace); - if (!(res = lazy_sweep(objspace))) { - /* there is no freespace after slot_sweep() */ - while (1) { - /* There is no empty RVALUE spaces */ - /* TODO: [RGENGC] Should do major GC before adding hepas */ - - set_heaps_increment(objspace); - heaps_increment(objspace); - - if (has_free_object) { - res = TRUE; - during_gc = 0; - break; + if (has_free_object) { + res = TRUE; + during_gc = 0; + break; + } } } } - gc_prof_timer_stop(objspace, Qtrue); return res; } @@ -3339,7 +3337,6 @@ gc_marks_body(rb_objspace_t *objspace, r https://github.com/ruby/ruby/blob/trunk/gc.c#L3337 gc_mark_stacked_objects(objspace); /* cleanup */ - gc_prof_mark_timer_stop(objspace); rgengc_report(1, objspace, "gc_marks_body: end.\n"); } @@ -3409,28 +3406,31 @@ gc_marks(rb_objspace_t *objspace, int mi https://github.com/ruby/ruby/blob/trunk/gc.c#L3406 struct mark_func_data_struct *prev_mark_func_data; rb_thread_t *th = GET_THREAD(); - /* setup marking */ - prev_mark_func_data = objspace->mark_func_data; - objspace->mark_func_data = 0; - gc_prof_mark_timer_start(objspace); - objspace->count++; + { + /* setup marking */ + prev_mark_func_data = objspace->mark_func_data; + objspace->mark_func_data = 0; - SET_STACK_END; + objspace->count++; - if (USE_RGENGC) { - objspace->rgengc.parent_object_is_promoted = FALSE; - objspace->rgengc.parent_object = Qundef; - objspace->rgengc.during_minor_gc = minor_gc; - } + SET_STACK_END; - gc_marks_body(objspace, th); + if (USE_RGENGC) { + objspace->rgengc.parent_object_is_promoted = FALSE; + objspace->rgengc.parent_object = Qundef; + objspace->rgengc.during_minor_gc = minor_gc; + } - if (RGENGC_CHECK_MODE > 1 && minor_gc) { - gc_marks_test(objspace, th); - } + gc_marks_body(objspace, th); + + if (RGENGC_CHECK_MODE > 1 && minor_gc) { + gc_marks_test(objspace, th); + } - objspace->mark_func_data = prev_mark_func_data; + objspace->mark_func_data = prev_mark_func_data; + } + gc_prof_mark_timer_stop(objspace); } /* RGENGC */ @@ -3689,16 +3689,16 @@ garbage_collect(rb_objspace_t *objspace) https://github.com/ruby/ruby/blob/trunk/gc.c#L3689 return TRUE; } - gc_prof_timer_start(objspace); - rest_sweep(objspace); - during_gc++; - gc_marks(objspace, FALSE); - - gc_sweep(objspace); - + gc_prof_timer_start(objspace); + { + during_gc++; + gc_marks(objspace, FALSE); + gc_sweep(objspace); + } gc_prof_timer_stop(objspace, Qtrue); + if (GC_NOTIFY) printf("end garbage_collect()\n"); return TRUE; } @@ -4782,7 +4782,7 @@ gc_prof_sweep_slot_timer_stop(rb_objspac https://github.com/ruby/ruby/blob/trunk/gc.c#L4782 sweep_time = getrusage_time() - objspace->profile.gc_sweep_start_time; if (sweep_time < 0) sweep_time = 0; - record->gc_sweep_time = sweep_time; + record->gc_sweep_time += sweep_time; } } @@ -4956,7 +4956,7 @@ gc_profile_dump_on(VALUE out, VALUE (*ap https://github.com/ruby/ruby/blob/trunk/gc.c#L4956 "Index Allocate Increase Allocate Limit Use Slot Have Finalize Mark Time(ms) Sweep Time(ms)\n")); index = 1; for (i = 0; i < count; i++) { - r = objspace->profile.record[i]; + record = &objspace->profile.record[i]; append(out, rb_sprintf("%5d %17"PRIuSIZE" %17"PRIuSIZE" %9"PRIuSIZE" %14s %25.20f %25.20f\n", index++, record->allocate_increase, record->allocate_limit, record->heap_use_slots, (record->have_finalize ? "true" : "false"), -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/