YJIT: Add object shape count to stats (#6754)
This commit is contained in:
parent
4b29eb17f2
commit
c80edc9f98
Notes:
git
2022-11-17 21:00:22 +00:00
Merged-By: k0kubun <takashikkbn@gmail.com>
8
yjit.c
8
yjit.c
@ -1071,6 +1071,14 @@ rb_yjit_invalidate_all_method_lookup_assumptions(void)
|
|||||||
// method caches, so we do nothing here for now.
|
// method caches, so we do nothing here for now.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Number of object shapes, which might be useful for investigating YJIT exit reasons.
|
||||||
|
static VALUE
|
||||||
|
object_shape_count(rb_execution_context_t *ec, VALUE self)
|
||||||
|
{
|
||||||
|
// next_shape_id starts from 0, so it's the same as the count
|
||||||
|
return ULONG2NUM((unsigned long)GET_VM()->next_shape_id);
|
||||||
|
}
|
||||||
|
|
||||||
// Primitives used by yjit.rb
|
// Primitives used by yjit.rb
|
||||||
VALUE rb_yjit_stats_enabled_p(rb_execution_context_t *ec, VALUE self);
|
VALUE rb_yjit_stats_enabled_p(rb_execution_context_t *ec, VALUE self);
|
||||||
VALUE rb_yjit_trace_exit_locations_enabled_p(rb_execution_context_t *ec, VALUE self);
|
VALUE rb_yjit_trace_exit_locations_enabled_p(rb_execution_context_t *ec, VALUE self);
|
||||||
|
6
yjit.rb
6
yjit.rb
@ -146,7 +146,10 @@ module RubyVM::YJIT
|
|||||||
# Return nil when option is not passed or unavailable.
|
# Return nil when option is not passed or unavailable.
|
||||||
def self.runtime_stats
|
def self.runtime_stats
|
||||||
stats = Primitive.rb_yjit_get_stats
|
stats = Primitive.rb_yjit_get_stats
|
||||||
return stats if stats.nil? || !Primitive.rb_yjit_stats_enabled_p
|
return stats if stats.nil?
|
||||||
|
|
||||||
|
stats[:object_shape_count] = Primitive.object_shape_count
|
||||||
|
return stats unless Primitive.rb_yjit_stats_enabled_p
|
||||||
|
|
||||||
side_exits = total_exit_count(stats)
|
side_exits = total_exit_count(stats)
|
||||||
total_exits = side_exits + stats[:leave_interp_return]
|
total_exits = side_exits + stats[:leave_interp_return]
|
||||||
@ -270,6 +273,7 @@ module RubyVM::YJIT
|
|||||||
$stderr.puts "freed_page_count: " + ("%10d" % stats[:freed_page_count])
|
$stderr.puts "freed_page_count: " + ("%10d" % stats[:freed_page_count])
|
||||||
$stderr.puts "code_gc_count: " + ("%10d" % stats[:code_gc_count])
|
$stderr.puts "code_gc_count: " + ("%10d" % stats[:code_gc_count])
|
||||||
$stderr.puts "num_gc_obj_refs: " + ("%10d" % stats[:num_gc_obj_refs])
|
$stderr.puts "num_gc_obj_refs: " + ("%10d" % stats[:num_gc_obj_refs])
|
||||||
|
$stderr.puts "object_shape_count: " + ("%10d" % stats[:object_shape_count])
|
||||||
$stderr.puts "side_exit_count: " + ("%10d" % stats[:side_exit_count])
|
$stderr.puts "side_exit_count: " + ("%10d" % stats[:side_exit_count])
|
||||||
$stderr.puts "total_exit_count: " + ("%10d" % stats[:total_exit_count])
|
$stderr.puts "total_exit_count: " + ("%10d" % stats[:total_exit_count])
|
||||||
$stderr.puts "total_insns_count: " + ("%10d" % stats[:total_insns_count]) if stats.key?(:total_insns_count)
|
$stderr.puts "total_insns_count: " + ("%10d" % stats[:total_insns_count]) if stats.key?(:total_insns_count)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user