зеркало из https://github.com/github/ruby.git
YJIT: Quiet mode when running with `--yjit-stats` (#8251)
Quiet mode for running with --yjit-stats
This commit is contained in:
Родитель
07833049df
Коммит
3dff315ed3
1
yjit.c
1
yjit.c
|
@ -1169,6 +1169,7 @@ rb_yjit_set_exception_return(rb_control_frame_t *cfp, void *leave_exit, void *le
|
|||
|
||||
// Primitives used by yjit.rb
|
||||
VALUE rb_yjit_stats_enabled_p(rb_execution_context_t *ec, VALUE self);
|
||||
VALUE rb_yjit_print_stats_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_get_stats(rb_execution_context_t *ec, VALUE self, VALUE context);
|
||||
VALUE rb_yjit_reset_stats_bang(rb_execution_context_t *ec, VALUE self);
|
||||
|
|
4
yjit.rb
4
yjit.rb
|
@ -226,7 +226,9 @@ module RubyVM::YJIT
|
|||
# Avoid calling a method here to not interfere with compilation tests
|
||||
if Primitive.rb_yjit_stats_enabled_p
|
||||
at_exit do
|
||||
_print_stats
|
||||
if Primitive.rb_yjit_print_stats_p
|
||||
_print_stats
|
||||
end
|
||||
_dump_locations
|
||||
end
|
||||
end
|
||||
|
|
|
@ -26,9 +26,12 @@ pub struct Options {
|
|||
// The number of registers allocated for stack temps
|
||||
pub num_temp_regs: usize,
|
||||
|
||||
// Capture and print out stats
|
||||
// Capture stats
|
||||
pub gen_stats: bool,
|
||||
|
||||
// Print stats on exit (when gen_stats is also true)
|
||||
pub print_stats: bool,
|
||||
|
||||
// Trace locations of exits
|
||||
pub gen_trace_exits: bool,
|
||||
|
||||
|
@ -62,6 +65,7 @@ pub static mut OPTIONS: Options = Options {
|
|||
num_temp_regs: 5,
|
||||
gen_stats: false,
|
||||
gen_trace_exits: false,
|
||||
print_stats: true,
|
||||
trace_exits_sample_rate: 0,
|
||||
pause: false,
|
||||
dump_insns: false,
|
||||
|
@ -176,7 +180,16 @@ pub fn parse_option(str_ptr: *const std::os::raw::c_char) -> Option<()> {
|
|||
|
||||
("greedy-versioning", "") => unsafe { OPTIONS.greedy_versioning = true },
|
||||
("no-type-prop", "") => unsafe { OPTIONS.no_type_prop = true },
|
||||
("stats", "") => unsafe { OPTIONS.gen_stats = true },
|
||||
("stats", _) => match opt_val.to_string().as_str() {
|
||||
"" => unsafe { OPTIONS.gen_stats = true },
|
||||
"quiet" => {
|
||||
unsafe { OPTIONS.gen_stats = true }
|
||||
unsafe { OPTIONS.print_stats = false }
|
||||
},
|
||||
_ => {
|
||||
return None;
|
||||
}
|
||||
},
|
||||
("trace-exits", "") => unsafe { OPTIONS.gen_trace_exits = true; OPTIONS.gen_stats = true; OPTIONS.trace_exits_sample_rate = 0 },
|
||||
("trace-exits-sample-rate", sample_rate) => unsafe { OPTIONS.gen_trace_exits = true; OPTIONS.gen_stats = true; OPTIONS.trace_exits_sample_rate = sample_rate.parse().unwrap(); },
|
||||
("dump-insns", "") => unsafe { OPTIONS.dump_insns = true },
|
||||
|
|
|
@ -463,6 +463,17 @@ pub extern "C" fn rb_yjit_stats_enabled_p(_ec: EcPtr, _ruby_self: VALUE) -> VALU
|
|||
}
|
||||
}
|
||||
|
||||
/// Primitive called in yjit.rb
|
||||
/// Check if stats generation should print at exit
|
||||
#[no_mangle]
|
||||
pub extern "C" fn rb_yjit_print_stats_p(_ec: EcPtr, _ruby_self: VALUE) -> VALUE {
|
||||
if get_option!(print_stats) {
|
||||
return Qtrue;
|
||||
} else {
|
||||
return Qfalse;
|
||||
}
|
||||
}
|
||||
|
||||
/// Primitive called in yjit.rb.
|
||||
/// Export all YJIT statistics as a Ruby hash.
|
||||
#[no_mangle]
|
||||
|
|
Загрузка…
Ссылка в новой задаче