[前][次][番号順一覧][スレッド一覧]

ruby-changes:72097

From: Peter <ko1@a...>
Date: Wed, 8 Jun 2022 23:04:37 +0900 (JST)
Subject: [ruby-changes:72097] fafe68185c (master): Add key force_major_gc_count to GC.stat_heap

https://git.ruby-lang.org/ruby.git/commit/?id=fafe68185c

From fafe68185c1c39949d69754cfac5a15c3438ec08 Mon Sep 17 00:00:00 2001
From: Peter Zhu <peter@p...>
Date: Wed, 8 Jun 2022 10:03:00 -0400
Subject: Add key force_major_gc_count to GC.stat_heap

force_major_gc_count is the number of times the size pool forced major
GC to run.
---
 gc.c                 | 3 +++
 test/ruby/test_gc.rb | 1 +
 2 files changed, 4 insertions(+)

diff --git a/gc.c b/gc.c
index a128e9a93e..4f5d50d67a 100644
--- a/gc.c
+++ b/gc.c
@@ -11005,6 +11005,7 @@ enum gc_stat_heap_sym { https://github.com/ruby/ruby/blob/trunk/gc.c#L11005
     gc_stat_heap_sym_heap_tomb_slots,
     gc_stat_heap_sym_total_allocated_pages,
     gc_stat_heap_sym_total_freed_pages,
+    gc_stat_heap_sym_force_major_gc_count,
     gc_stat_heap_sym_last
 };
 
@@ -11023,6 +11024,7 @@ setup_gc_stat_heap_symbols(void) https://github.com/ruby/ruby/blob/trunk/gc.c#L11024
         S(heap_tomb_slots);
         S(total_allocated_pages);
         S(total_freed_pages);
+        S(force_major_gc_count);
 #undef S
     }
 }
@@ -11065,6 +11067,7 @@ gc_stat_heap_internal(int size_pool_idx, VALUE hash_or_sym) https://github.com/ruby/ruby/blob/trunk/gc.c#L11067
     SET(heap_tomb_slots, SIZE_POOL_TOMB_HEAP(size_pool)->total_slots);
     SET(total_allocated_pages, size_pool->total_allocated_pages);
     SET(total_freed_pages, size_pool->total_freed_pages);
+    SET(force_major_gc_count, size_pool->force_major_gc_count);
 #undef SET
 
     if (!NIL_P(key)) { /* matched key should return above */
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb
index b081e9fa78..a5d7f4dbaa 100644
--- a/test/ruby/test_gc.rb
+++ b/test/ruby/test_gc.rb
@@ -160,6 +160,7 @@ class TestGc < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_gc.rb#L160
       assert_operator stat_heap[:heap_tomb_slots], :>=, 0
       assert_operator stat_heap[:total_allocated_pages], :>=, 0
       assert_operator stat_heap[:total_freed_pages], :>=, 0
+      assert_operator stat_heap[:force_major_gc_count], :>=, 0
     end
 
     GC.stat_heap(0, stat_heap)
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]