From c734405ccd3dfba58dffbb6413c36eec04dc1f36 Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Mon, 1 Feb 2021 17:03:50 -0500 Subject: [PATCH] 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; 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) 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) 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);