From 85173be41f27871cb36ae77b8abfa1e3c0ae2565 Mon Sep 17 00:00:00 2001 From: ko1 Date: Thu, 25 Oct 2018 02:23:58 +0000 Subject: [PATCH] add new counter about GC. * debug_counter.h: add `gc_major_oldmalloc`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- debug_counter.h | 1 + gc.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/debug_counter.h b/debug_counter.h index b29d5ef560..3fcb562f65 100644 --- a/debug_counter.h +++ b/debug_counter.h @@ -119,6 +119,7 @@ RB_DEBUG_COUNTER(gc_major_nofree) RB_DEBUG_COUNTER(gc_major_oldgen) RB_DEBUG_COUNTER(gc_major_shady) RB_DEBUG_COUNTER(gc_major_force) +RB_DEBUG_COUNTER(gc_major_oldmalloc) /* object allocation counts: * diff --git a/gc.c b/gc.c index c4d12770b2..c3c4f4ea57 100644 --- a/gc.c +++ b/gc.c @@ -6538,11 +6538,15 @@ gc_start(rb_objspace_t *objspace, int reason) #if USE_DEBUG_COUNTER RB_DEBUG_COUNTER_INC(gc_count); + if (reason & GPR_FLAG_MAJOR_MASK) { (void)RB_DEBUG_COUNTER_INC_IF(gc_major_nofree, reason & GPR_FLAG_MAJOR_BY_NOFREE); (void)RB_DEBUG_COUNTER_INC_IF(gc_major_oldgen, reason & GPR_FLAG_MAJOR_BY_OLDGEN); (void)RB_DEBUG_COUNTER_INC_IF(gc_major_shady, reason & GPR_FLAG_MAJOR_BY_SHADY); (void)RB_DEBUG_COUNTER_INC_IF(gc_major_force, reason & GPR_FLAG_MAJOR_BY_FORCE); +#if RGENGC_ESTIMATE_OLDMALLOC + (void)RB_DEBUG_COUNTER_INC_IF(gc_major_oldmalloc, reason & GPR_FLAG_MAJOR_BY_OLDMALLOC); +#endif } else { (void)RB_DEBUG_COUNTER_INC_IF(gc_minor_newobj, reason & GPR_FLAG_NEWOBJ);