1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Add stats for number of ujit entry points installed

shopify/ruby#23
This commit is contained in:
Alan Wu 2021-02-01 17:03:50 -05:00
parent 6a29131439
commit c734405ccd

View file

@ -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);