зеркало из https://github.com/github/ruby.git
Add compiled_block_count
This commit is contained in:
Родитель
5c638c97bb
Коммит
4bb4479165
|
@ -224,6 +224,14 @@ module RubyVM::MJIT
|
|||
raise "compiling #{insn.name} returned unexpected status: #{status.inspect}"
|
||||
end
|
||||
end
|
||||
|
||||
incr_counter(:compiled_block_count)
|
||||
end
|
||||
|
||||
def incr_counter(name)
|
||||
if C.mjit_opts.stats
|
||||
C.rb_mjit_counters[name][0] += 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -36,6 +36,7 @@ module RubyVM::MJIT
|
|||
|
||||
print_counters(stats, prefix: 'send_', prompt: 'method call exit reasons')
|
||||
|
||||
$stderr.puts "compiled_block_count: #{format('%10d', stats[:compiled_block_count])}"
|
||||
$stderr.puts "side_exit_count: #{format('%10d', stats[:side_exit_count])}"
|
||||
$stderr.puts "total_insns_count: #{format('%10d', stats[:total_insns_count])}" if stats.key?(:total_insns_count)
|
||||
$stderr.puts "vm_insns_count: #{format('%10d', stats[:vm_insns_count])}" if stats.key?(:vm_insns_count)
|
||||
|
|
9
mjit.c
9
mjit.c
|
@ -491,6 +491,15 @@ mjit_stats_enabled_p(rb_execution_context_t *ec, VALUE self)
|
|||
return RBOOL(mjit_stats_enabled);
|
||||
}
|
||||
|
||||
// Disable anything that could impact stats. It ends up disabling JIT calls as well.
|
||||
static VALUE
|
||||
mjit_stop_stats(rb_execution_context_t *ec, VALUE self)
|
||||
{
|
||||
mjit_call_p = false;
|
||||
mjit_stats_p = false;
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
#include "mjit.rbinc"
|
||||
|
||||
#endif // USE_MJIT
|
||||
|
|
5
mjit.rb
5
mjit.rb
|
@ -15,7 +15,10 @@ module RubyVM::MJIT
|
|||
end
|
||||
|
||||
if Primitive.mjit_stats_enabled_p
|
||||
at_exit { print_stats }
|
||||
at_exit do
|
||||
Primitive.mjit_stop_stats
|
||||
print_stats
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
3
mjit_c.h
3
mjit_c.h
|
@ -107,6 +107,7 @@ extern uint8_t *rb_mjit_mem_block;
|
|||
#define MJIT_RUNTIME_COUNTERS(...) struct rb_mjit_runtime_counters { size_t __VA_ARGS__; };
|
||||
MJIT_RUNTIME_COUNTERS(
|
||||
vm_insns_count,
|
||||
mjit_insns_count,
|
||||
|
||||
send_kw_splat,
|
||||
send_guard_known_object,
|
||||
|
@ -118,7 +119,7 @@ MJIT_RUNTIME_COUNTERS(
|
|||
send_kwarg,
|
||||
send_tailcall,
|
||||
|
||||
mjit_insns_count
|
||||
compiled_block_count
|
||||
)
|
||||
#undef MJIT_RUNTIME_COUNTERS
|
||||
extern struct rb_mjit_runtime_counters rb_mjit_counters;
|
||||
|
|
|
@ -796,6 +796,7 @@ module RubyVM::MJIT # :nodoc: all
|
|||
@rb_mjit_runtime_counters ||= CType::Struct.new(
|
||||
"rb_mjit_runtime_counters", Primitive.cexpr!("SIZEOF(struct rb_mjit_runtime_counters)"),
|
||||
vm_insns_count: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), vm_insns_count)")],
|
||||
mjit_insns_count: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), mjit_insns_count)")],
|
||||
send_kw_splat: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_kw_splat)")],
|
||||
send_guard_known_object: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_guard_known_object)")],
|
||||
send_missing_cme: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_missing_cme)")],
|
||||
|
@ -805,7 +806,7 @@ module RubyVM::MJIT # :nodoc: all
|
|||
send_args_splat: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_args_splat)")],
|
||||
send_kwarg: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_kwarg)")],
|
||||
send_tailcall: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), send_tailcall)")],
|
||||
mjit_insns_count: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), mjit_insns_count)")],
|
||||
compiled_block_count: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_mjit_runtime_counters *)NULL)), compiled_block_count)")],
|
||||
)
|
||||
end
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче