diff options
author | tarui <tarui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-15 17:06:15 +0000 |
---|---|---|
committer | tarui <tarui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-15 17:06:15 +0000 |
commit | 6477616c3b79f0643ac769302f1aebfc3c7904d5 (patch) | |
tree | ee388a246ce1a05ae8f1f825ad1df6c7c5649d4c /gc.c | |
parent | 3557381979562a8b74d94e09b0d4fb35c7b35ec4 (diff) | |
download | ruby-6477616c3b79f0643ac769302f1aebfc3c7904d5.tar.gz |
* gc.c (gc_prof_timer_stop): Merge function codes of GC_PROFILE_MORE_DETAIL and !GC_PROFILE_MORE_DETAIL.
* gc.c (gc_prof_mark_timer_start): Ditto.
* gc.c (gc_prof_mark_timer_stop): Ditto.
* gc.c (gc_prof_sweep_slot_timer_start): Ditto.
* gc.c (gc_prof_sweep_slot_timer_stop): Ditto.
* gc.c (gc_prof_set_malloc_info): Ditto.
* gc.c (gc_prof_set_heap_info): Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 64 |
1 files changed, 12 insertions, 52 deletions
@@ -4853,57 +4853,6 @@ gc_prof_timer_stop(rb_objspace_t *objspace) } } -#if !GC_PROFILE_MORE_DETAIL - -static inline void -gc_prof_mark_timer_start(rb_objspace_t *objspace) -{ - if (RUBY_DTRACE_GC_MARK_BEGIN_ENABLED()) { - RUBY_DTRACE_GC_MARK_BEGIN(); - } -} - -static inline void -gc_prof_mark_timer_stop(rb_objspace_t *objspace) -{ - if (RUBY_DTRACE_GC_MARK_END_ENABLED()) { - RUBY_DTRACE_GC_MARK_END(); - } -} - -static inline void -gc_prof_sweep_slot_timer_start(rb_objspace_t *objspace) -{ - if (RUBY_DTRACE_GC_SWEEP_BEGIN_ENABLED()) { - RUBY_DTRACE_GC_SWEEP_BEGIN(); - } -} - -static inline void -gc_prof_sweep_slot_timer_stop(rb_objspace_t *objspace) -{ - if (RUBY_DTRACE_GC_SWEEP_END_ENABLED()) { - RUBY_DTRACE_GC_SWEEP_END(); - } -} - -static inline void -gc_prof_set_malloc_info(rb_objspace_t *objspace) -{ -} - -static inline void -gc_prof_set_heap_info(rb_objspace_t *objspace, gc_profile_record *record) -{ - size_t live = objspace_live_num(objspace); - size_t total = heaps_used * HEAP_OBJ_LIMIT; - - record->heap_total_objects = total; - record->heap_use_size = live * sizeof(RVALUE); - record->heap_total_size = total * sizeof(RVALUE); -} - -#else /* !GC_PROFILE_MORE_DETAIL */ static inline void gc_prof_mark_timer_start(rb_objspace_t *objspace) @@ -4911,9 +4860,11 @@ gc_prof_mark_timer_start(rb_objspace_t *objspace) if (RUBY_DTRACE_GC_MARK_BEGIN_ENABLED()) { RUBY_DTRACE_GC_MARK_BEGIN(); } +#if GC_PROFILE_MORE_DETAIL if (objspace->profile.run) { gc_prof_record(objspace)->gc_mark_time = getrusage_time(); } +#endif } static inline void @@ -4922,6 +4873,7 @@ gc_prof_mark_timer_stop(rb_objspace_t *objspace) if (RUBY_DTRACE_GC_MARK_END_ENABLED()) { RUBY_DTRACE_GC_MARK_END(); } +#if GC_PROFILE_MORE_DETAIL if (objspace->profile.run) { double mark_time = 0; gc_profile_record *record = gc_prof_record(objspace); @@ -4930,6 +4882,7 @@ gc_prof_mark_timer_stop(rb_objspace_t *objspace) if (mark_time < 0) mark_time = 0; record->gc_mark_time = mark_time; } +#endif } static inline void @@ -4938,9 +4891,11 @@ gc_prof_sweep_slot_timer_start(rb_objspace_t *objspace) if (RUBY_DTRACE_GC_SWEEP_BEGIN_ENABLED()) { RUBY_DTRACE_GC_SWEEP_BEGIN(); } +#if GC_PROFILE_MORE_DETAIL if (objspace->profile.run) { objspace->profile.gc_sweep_start_time = getrusage_time(); } +#endif } static inline void @@ -4949,6 +4904,7 @@ gc_prof_sweep_slot_timer_stop(rb_objspace_t *objspace) if (RUBY_DTRACE_GC_SWEEP_END_ENABLED()) { RUBY_DTRACE_GC_SWEEP_END(); } +#if GC_PROFILE_MORE_DETAIL if (objspace->profile.run) { double sweep_time = 0; gc_profile_record *record = gc_prof_record(objspace); @@ -4959,16 +4915,19 @@ gc_prof_sweep_slot_timer_stop(rb_objspace_t *objspace) if (deferred_final_list) record->flags |= GPR_FLAG_HAVE_FINALIZE; } +#endif } static inline void gc_prof_set_malloc_info(rb_objspace_t *objspace) { +#if GC_PROFILE_MORE_DETAIL if (objspace->profile.run) { gc_profile_record *record = gc_prof_record(objspace); record->allocate_increase = malloc_increase; record->allocate_limit = malloc_limit; } +#endif } static inline void @@ -4977,15 +4936,16 @@ gc_prof_set_heap_info(rb_objspace_t *objspace, gc_profile_record *record) size_t live = objspace_live_num(objspace); size_t total = heaps_used * HEAP_OBJ_LIMIT; +#if GC_PROFILE_MORE_DETAIL record->heap_use_slots = heaps_used; record->heap_live_objects = live; record->heap_free_objects = total - live; +#endif record->heap_total_objects = total; record->heap_use_size = live * sizeof(RVALUE); record->heap_total_size = total * sizeof(RVALUE); } -#endif /* !GC_PROFILE_MORE_DETAIL */ /* |