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

ruby-changes:69173

From: Alan <ko1@a...>
Date: Thu, 21 Oct 2021 08:21:07 +0900 (JST)
Subject: [ruby-changes:69173] 82405ac48a (master): Add counters for tracking invalidations

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

From 82405ac48ae457de9b54e18545743ab2a58bf989 Mon Sep 17 00:00:00 2001
From: Alan Wu <XrXr@u...>
Date: Wed, 15 Sep 2021 13:59:50 -0400
Subject: Add counters for tracking invalidations

---
 yjit.rb      | 3 +++
 yjit_core.c  | 8 ++++++++
 yjit_iface.c | 3 +++
 yjit_iface.h | 3 +++
 4 files changed, 17 insertions(+)

diff --git a/yjit.rb b/yjit.rb
index 520c043068..f327b5a564 100644
--- a/yjit.rb
+++ b/yjit.rb
@@ -177,6 +177,9 @@ module YJIT https://github.com/ruby/ruby/blob/trunk/yjit.rb#L177
       yjit_ratio_pct = 100.0 * retired_in_yjit.to_f / total_insns_count
 
       $stderr.puts "compiled_iseq_count:   " + ("%10d" % stats[:compiled_iseq_count])
+      $stderr.puts "compiled_block_count:  " + ("%10d" % stats[:compiled_block_count])
+      $stderr.puts "invalidation_count:    " + ("%10d" % stats[:invalidation_count])
+      $stderr.puts "constant_state_bumps:  " + ("%10d" % stats[:constant_state_bumps])
       $stderr.puts "inline_code_size:      " + ("%10d" % stats[:inline_code_size])
       $stderr.puts "outlined_code_size:    " + ("%10d" % stats[:outlined_code_size])
 
diff --git a/yjit_core.c b/yjit_core.c
index 77e5b98190..6c2e1b0ae0 100644
--- a/yjit_core.c
+++ b/yjit_core.c
@@ -557,6 +557,10 @@ add_block_version(blockid_t blockid, block_t* block) https://github.com/ruby/ruby/blob/trunk/yjit_core.c#L557
             RB_OBJ_WRITTEN(iseq, Qundef, object);
         }
     }
+
+#if YJIT_STATS
+    yjit_runtime_counters.compiled_block_count++;
+#endif
 }
 
 // Create a new outgoing branch entry for a block
@@ -1144,6 +1148,10 @@ invalidate_block_version(block_t *block) https://github.com/ruby/ruby/blob/trunk/yjit_core.c#L1148
 
     yjit_free_block(block);
 
+#if YJIT_STATS
+    yjit_runtime_counters.invalidation_count++;
+#endif
+
     // fprintf(stderr, "invalidation done\n");
 }
 
diff --git a/yjit_iface.c b/yjit_iface.c
index 42f22f3939..0f11fa61a5 100644
--- a/yjit_iface.c
+++ b/yjit_iface.c
@@ -591,6 +591,9 @@ rb_yjit_constant_state_changed(void) https://github.com/ruby/ruby/blob/trunk/yjit_iface.c#L591
 {
     if (blocks_assuming_stable_global_constant_state) {
         st_foreach(blocks_assuming_stable_global_constant_state, block_invalidation_iterator, 0);
+#if YJIT_STATS
+        yjit_runtime_counters.constant_state_bumps++;
+#endif
     }
 }
 
diff --git a/yjit_iface.h b/yjit_iface.h
index b53059b6da..c42b29e977 100644
--- a/yjit_iface.h
+++ b/yjit_iface.h
@@ -87,6 +87,9 @@ YJIT_DECLARE_COUNTERS( https://github.com/ruby/ruby/blob/trunk/yjit_iface.h#L87
 
     vm_insns_count,
     compiled_iseq_count,
+    compiled_block_count,
+    invalidation_count,
+    constant_state_bumps,
 
     expandarray_splat,
     expandarray_postarg,
-- 
cgit v1.2.1


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

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