зеркало из https://github.com/github/ruby.git
Quiet mode for running with --yjit-stats
This commit is contained in:
Родитель
88ada74560
Коммит
6c4132fc74
1
yjit.c
1
yjit.c
|
@ -1134,6 +1134,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 rb_yjit_reset_stats_bang(rb_execution_context_t *ec, VALUE self);
|
||||
|
|
4
yjit.rb
4
yjit.rb
|
@ -229,7 +229,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
|
||||
|
|
|
@ -22,9 +22,12 @@ pub struct Options {
|
|||
// 1 means always create generic versions
|
||||
pub max_versions: 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,
|
||||
|
||||
|
@ -61,6 +64,7 @@ pub static mut OPTIONS: Options = Options {
|
|||
gen_stats: false,
|
||||
gen_trace_exits: false,
|
||||
pause: false,
|
||||
print_stats: true,
|
||||
dump_insns: false,
|
||||
dump_disasm: None,
|
||||
verify_ctx: false,
|
||||
|
@ -164,7 +168,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 },
|
||||
("dump-insns", "") => unsafe { OPTIONS.dump_insns = true },
|
||||
("verify-ctx", "") => unsafe { OPTIONS.verify_ctx = true },
|
||||
|
|
|
@ -397,6 +397,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]
|
||||
|
|
Загрузка…
Ссылка в новой задаче