summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--gc.c64
2 files changed, 22 insertions, 52 deletions
diff --git a/ChangeLog b/ChangeLog
index 5fe457a02f..6c55289ac9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Sun Jun 16 02:04:40 2013 Masaya Tarui <tarui@ruby-lang.org>
+
+ * 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.
+
Sat Jun 15 23:50:24 2013 Tanaka Akira <akr@fsij.org>
* bignum.c (bary_sub): New function.
diff --git a/gc.c b/gc.c
index 5903be4571..6057788404 100644
--- a/gc.c
+++ b/gc.c
@@ -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 */
/*