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

ruby-changes:68887

From: Maxime <ko1@a...>
Date: Thu, 21 Oct 2021 08:15:04 +0900 (JST)
Subject: [ruby-changes:68887] 032b2ecf4b (master): Compute percentage of exits for top-10 exit ops

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

From 032b2ecf4b026d2945659d8de325ad3ef6ad4734 Mon Sep 17 00:00:00 2001
From: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@s...>
Date: Thu, 8 Apr 2021 15:18:18 -0400
Subject: Compute percentage of exits for top-10 exit ops

---
 yjit_iface.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/yjit_iface.c b/yjit_iface.c
index 1ac36b8cf2..4116e526d8 100644
--- a/yjit_iface.c
+++ b/yjit_iface.c
@@ -829,17 +829,21 @@ print_insn_count_buffer(int how_many, int left_pad) https://github.com/ruby/ruby/blob/trunk/yjit_iface.c#L829
     // Sort the exit ops by decreasing frequency
     const struct insn_count *sorted_exit_ops = sort_insn_count_array(exit_op_count);
 
-    // Compute the longest instruction name
+    // Compute the longest instruction name and top10_exit_count
     size_t longest_insn_len = 0;
+    size_t top10_exit_count = 0;
     for (int i = 0; i < how_many; i++) {
         const char *instruction_name = insn_name(sorted_exit_ops[i].insn);
         size_t len = strlen(instruction_name);
         if (len > longest_insn_len) {
             longest_insn_len = len;
         }
+        top10_exit_count += sorted_exit_ops[i].count;
     }
 
-    fprintf(stderr, "most frequent exit op:\n");
+    double top10_exit_percent = 100.0 * top10_exit_count / total_exit_count;
+
+    fprintf(stderr, "top-%d most frequent exit ops (%.1f%% of exits):\n", how_many, top10_exit_percent);
 
     // Print the top-N most frequent exit counts
     for (int i = 0; i < how_many; i++) {
-- 
cgit v1.2.1


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

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