@@ -608,6 +608,11 @@ typedef struct rb_objspace {
608608
609609 size_t minor_gc_count ;
610610 size_t major_gc_count ;
611+ size_t major_gc_count_by_nofree ;
612+ size_t major_gc_count_by_oldgen ;
613+ size_t major_gc_count_by_shady ;
614+ size_t major_gc_count_by_force ;
615+ size_t major_gc_count_by_oldmalloc ;
611616 size_t compact_count ;
612617 size_t read_barrier_faults ;
613618#if RGENGC_PROFILE > 0
@@ -7968,6 +7973,11 @@ gc_start(rb_objspace_t *objspace, unsigned int reason)
79687973#if RGENGC_ESTIMATE_OLDMALLOC
79697974 (void )RB_DEBUG_COUNTER_INC_IF (gc_major_oldmalloc , reason & GPR_FLAG_MAJOR_BY_OLDMALLOC );
79707975#endif
7976+ if (reason & GPR_FLAG_MAJOR_BY_NOFREE ) objspace -> profile .major_gc_count_by_nofree ++ ;
7977+ if (reason & GPR_FLAG_MAJOR_BY_OLDGEN ) objspace -> profile .major_gc_count_by_oldgen ++ ;
7978+ if (reason & GPR_FLAG_MAJOR_BY_SHADY ) objspace -> profile .major_gc_count_by_shady ++ ;
7979+ if (reason & GPR_FLAG_MAJOR_BY_FORCE ) objspace -> profile .major_gc_count_by_force ++ ;
7980+ if (reason & GPR_FLAG_MAJOR_BY_OLDMALLOC ) objspace -> profile .major_gc_count_by_oldmalloc ++ ;
79717981 }
79727982 else {
79737983 (void )RB_DEBUG_COUNTER_INC_IF (gc_minor_newobj , reason & GPR_FLAG_NEWOBJ );
@@ -9043,6 +9053,11 @@ enum gc_stat_sym {
90439053 gc_stat_sym_malloc_increase_bytes_limit ,
90449054 gc_stat_sym_minor_gc_count ,
90459055 gc_stat_sym_major_gc_count ,
9056+ gc_stat_sym_major_gc_count_by_nofree ,
9057+ gc_stat_sym_major_gc_count_by_oldgen ,
9058+ gc_stat_sym_major_gc_count_by_shady ,
9059+ gc_stat_sym_major_gc_count_by_force ,
9060+ gc_stat_sym_major_gc_count_by_oldmalloc ,
90469061 gc_stat_sym_compact_count ,
90479062 gc_stat_sym_read_barrier_faults ,
90489063 gc_stat_sym_total_moved_objects ,
@@ -9096,6 +9111,11 @@ setup_gc_stat_symbols(void)
90969111 S (malloc_increase_bytes_limit );
90979112 S (minor_gc_count );
90989113 S (major_gc_count );
9114+ S (major_gc_count_by_nofree );
9115+ S (major_gc_count_by_oldgen );
9116+ S (major_gc_count_by_shady );
9117+ S (major_gc_count_by_force );
9118+ S (major_gc_count_by_oldmalloc );
90999119 S (compact_count );
91009120 S (read_barrier_faults );
91019121 S (total_moved_objects );
@@ -9180,6 +9200,11 @@ rb_gc_impl_stat(void *objspace_ptr, VALUE hash_or_sym)
91809200 SET (malloc_increase_bytes_limit , malloc_limit );
91819201 SET (minor_gc_count , objspace -> profile .minor_gc_count );
91829202 SET (major_gc_count , objspace -> profile .major_gc_count );
9203+ SET (major_gc_count_by_nofree , objspace -> profile .major_gc_count_by_nofree );
9204+ SET (major_gc_count_by_oldgen , objspace -> profile .major_gc_count_by_oldgen );
9205+ SET (major_gc_count_by_shady , objspace -> profile .major_gc_count_by_shady );
9206+ SET (major_gc_count_by_force , objspace -> profile .major_gc_count_by_force );
9207+ SET (major_gc_count_by_oldmalloc , objspace -> profile .major_gc_count_by_oldmalloc );
91839208 SET (compact_count , objspace -> profile .compact_count );
91849209 SET (read_barrier_faults , objspace -> profile .read_barrier_faults );
91859210 SET (total_moved_objects , objspace -> rcompactor .total_moved );
0 commit comments