@@ -555,6 +555,11 @@ typedef struct rb_objspace {
555555
556556 size_t minor_gc_count ;
557557 size_t major_gc_count ;
558+ size_t major_gc_count_by_nofree ;
559+ size_t major_gc_count_by_oldgen ;
560+ size_t major_gc_count_by_shady ;
561+ size_t major_gc_count_by_force ;
562+ size_t major_gc_count_by_oldmalloc ;
558563 size_t compact_count ;
559564 size_t read_barrier_faults ;
560565#if RGENGC_PROFILE > 0
@@ -6489,6 +6494,11 @@ gc_start(rb_objspace_t *objspace, unsigned int reason)
64896494#if RGENGC_ESTIMATE_OLDMALLOC
64906495 (void )RB_DEBUG_COUNTER_INC_IF (gc_major_oldmalloc , reason & GPR_FLAG_MAJOR_BY_OLDMALLOC );
64916496#endif
6497+ if (reason & GPR_FLAG_MAJOR_BY_NOFREE ) objspace -> profile .major_gc_count_by_nofree ++ ;
6498+ if (reason & GPR_FLAG_MAJOR_BY_OLDGEN ) objspace -> profile .major_gc_count_by_oldgen ++ ;
6499+ if (reason & GPR_FLAG_MAJOR_BY_SHADY ) objspace -> profile .major_gc_count_by_shady ++ ;
6500+ if (reason & GPR_FLAG_MAJOR_BY_FORCE ) objspace -> profile .major_gc_count_by_force ++ ;
6501+ if (reason & GPR_FLAG_MAJOR_BY_OLDMALLOC ) objspace -> profile .major_gc_count_by_oldmalloc ++ ;
64926502 }
64936503 else {
64946504 (void )RB_DEBUG_COUNTER_INC_IF (gc_minor_newobj , reason & GPR_FLAG_NEWOBJ );
@@ -7460,6 +7470,11 @@ enum gc_stat_sym {
74607470 gc_stat_sym_malloc_increase_bytes_limit ,
74617471 gc_stat_sym_minor_gc_count ,
74627472 gc_stat_sym_major_gc_count ,
7473+ gc_stat_sym_major_gc_count_by_nofree ,
7474+ gc_stat_sym_major_gc_count_by_oldgen ,
7475+ gc_stat_sym_major_gc_count_by_shady ,
7476+ gc_stat_sym_major_gc_count_by_force ,
7477+ gc_stat_sym_major_gc_count_by_oldmalloc ,
74637478 gc_stat_sym_compact_count ,
74647479 gc_stat_sym_read_barrier_faults ,
74657480 gc_stat_sym_total_moved_objects ,
@@ -7511,6 +7526,11 @@ setup_gc_stat_symbols(void)
75117526 S (malloc_increase_bytes_limit );
75127527 S (minor_gc_count );
75137528 S (major_gc_count );
7529+ S (major_gc_count_by_nofree );
7530+ S (major_gc_count_by_oldgen );
7531+ S (major_gc_count_by_shady );
7532+ S (major_gc_count_by_force );
7533+ S (major_gc_count_by_oldmalloc );
75147534 S (compact_count );
75157535 S (read_barrier_faults );
75167536 S (total_moved_objects );
@@ -7593,6 +7613,11 @@ rb_gc_impl_stat(void *objspace_ptr, VALUE hash_or_sym)
75937613 SET (malloc_increase_bytes_limit , malloc_limit );
75947614 SET (minor_gc_count , objspace -> profile .minor_gc_count );
75957615 SET (major_gc_count , objspace -> profile .major_gc_count );
7616+ SET (major_gc_count_by_nofree , objspace -> profile .major_gc_count_by_nofree );
7617+ SET (major_gc_count_by_oldgen , objspace -> profile .major_gc_count_by_oldgen );
7618+ SET (major_gc_count_by_shady , objspace -> profile .major_gc_count_by_shady );
7619+ SET (major_gc_count_by_force , objspace -> profile .major_gc_count_by_force );
7620+ SET (major_gc_count_by_oldmalloc , objspace -> profile .major_gc_count_by_oldmalloc );
75967621 SET (compact_count , objspace -> profile .compact_count );
75977622 SET (read_barrier_faults , objspace -> profile .read_barrier_faults );
75987623 SET (total_moved_objects , objspace -> rcompactor .total_moved );
0 commit comments