Module
Class Methods
::
rjit.rb
View on GitHub
# File tmp/rubies/ruby-master/rjit.rb, line 8
def self.enable
Primitive.cstmt! %{
rb_rjit_call_p = true;
return Qnil;
}
end
Start JIT compilation after --rjit-disable.
::
rjit.rb
View on GitHub
# File tmp/rubies/ruby-master/rjit.rb, line 3
def self.enabled?
Primitive.cexpr! 'RBOOL(rb_rjit_enabled)'
end
Return true if RJIT is enabled.
lib/ruby_vm/rjit/stats.rb
View on GitHub
# File tmp/rubies/ruby-master/lib/ruby_vm/rjit/stats.rb, line 4
def self.runtime_stats
stats = {}
# Insn exits
INSNS.each_value do |insn|
exits = C.rjit_insn_exits[insn.bin]
if exits > 0
stats[:"exit_#{insn.name}"] = exits
end
end
# Runtime stats
C.rb_rjit_runtime_counters.members.each do |member|
stats[member] = C.rb_rjit_counters.public_send(member)
end
stats[:vm_insns_count] = C.rb_vm_insns_count
# Other stats are calculated here
stats[:side_exit_count] = stats.select { |name, _count| name.start_with?('exit_') }.sum(&:last)
if stats[:vm_insns_count] > 0
retired_in_rjit = stats[:rjit_insns_count] - stats[:side_exit_count]
stats[:total_insns_count] = retired_in_rjit + stats[:vm_insns_count]
stats[:ratio_in_rjit] = 100.0 * retired_in_rjit / stats[:total_insns_count]
else
stats.delete(:vm_insns_count)
end
stats
end
Return a Hash
for RJIT statistics. --rjit-stats makes more information available.