ruby-changes:68730
From: Alan <ko1@a...>
Date: Thu, 21 Oct 2021 08:12:37 +0900 (JST)
Subject: [ruby-changes:68730] c734405ccd (master): Add stats for number of ujit entry points installed
https://git.ruby-lang.org/ruby.git/commit/?id=c734405ccd From c734405ccd3dfba58dffbb6413c36eec04dc1f36 Mon Sep 17 00:00:00 2001 From: Alan Wu <XrXr@u...> Date: Mon, 1 Feb 2021 17:03:50 -0500 Subject: Add stats for number of ujit entry points installed shopify/ruby#23 --- ujit_iface.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ujit_iface.c b/ujit_iface.c index f364a7564c..a793a6edfe 100644 --- a/ujit_iface.c +++ b/ujit_iface.c @@ -28,6 +28,7 @@ bool rb_ujit_enabled; https://github.com/ruby/ruby/blob/trunk/ujit_iface.c#L28 static int64_t vm_insns_count = 0; int64_t rb_ujit_exec_insns_count = 0; static int64_t exit_op_count[VM_INSTRUCTION_SIZE] = { 0 }; +static int64_t compiled_iseq_count = 0; extern st_table * version_tbl; extern codeblock_t *cb; @@ -322,6 +323,7 @@ rb_ujit_compile_iseq(const rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/ujit_iface.c#L323 int first_opcode = opcode_at_pc(iseq, &encoded[0]); map_addr2insn(code_ptr, first_opcode); encoded[0] = (VALUE)code_ptr; + compiled_iseq_count++; } RB_VM_LOCK_LEAVE(); @@ -545,6 +547,7 @@ print_ujit_stats(void) https://github.com/ruby/ruby/blob/trunk/ujit_iface.c#L547 double total_insns_count = vm_insns_count + rb_ujit_exec_insns_count; double ratio = rb_ujit_exec_insns_count / total_insns_count; + fprintf(stderr, "compiled_iseq_count: %10" PRId64 "\n", compiled_iseq_count); fprintf(stderr, "vm_insns_count: %10" PRId64 "\n", vm_insns_count); fprintf(stderr, "ujit_exec_insns_count: %10" PRId64 "\n", rb_ujit_exec_insns_count); fprintf(stderr, "ratio_in_ujit: %9.1f%%\n", ratio * 100); -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/