diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2023-09-13 07:45:40 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-13 10:45:40 -0400 |
commit | 721d21d30195f57b212e518ebf475a8c913955e0 (patch) | |
tree | de785fb3435eb0f99a4c33d6d1833ab5b28e36c6 /yjit | |
parent | 90838a949053d7f240ddab2067b1dde8cca2ae7b (diff) |
YJIT: Make compile_time_ns a default counter (#8425)
Notes
Notes:
Merged-By: maximecb <maximecb@ruby-lang.org>
Diffstat (limited to 'yjit')
-rw-r--r-- | yjit/src/stats.rs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/yjit/src/stats.rs b/yjit/src/stats.rs index 30b60d9617..e52611ed67 100644 --- a/yjit/src/stats.rs +++ b/yjit/src/stats.rs @@ -167,13 +167,14 @@ macro_rules! make_counters { /// The list of counters that are available without --yjit-stats. /// They are incremented only by `incr_counter!` and don't use `gen_counter_incr`. -pub const DEFAULT_COUNTERS: [Counter; 6] = [ +pub const DEFAULT_COUNTERS: [Counter; 7] = [ Counter::code_gc_count, Counter::compiled_iseq_entry, Counter::compiled_iseq_count, Counter::compiled_blockid_count, Counter::compiled_block_count, Counter::compiled_branch_count, + Counter::compile_time_ns, ]; /// Macro to increase a counter by name and count @@ -845,13 +846,9 @@ fn global_allocation_size() -> usize { /// Measure the time taken by func() and add that to yjit_compile_time. pub fn with_compile_time<F, R>(func: F) -> R where F: FnOnce() -> R { - if get_option!(gen_stats) { - let start = Instant::now(); - let ret = func(); - let nanos = Instant::now().duration_since(start).as_nanos(); - incr_counter_by!(compile_time_ns, nanos); - ret - } else { - func() - } + let start = Instant::now(); + let ret = func(); + let nanos = Instant::now().duration_since(start).as_nanos(); + incr_counter_by!(compile_time_ns, nanos); + ret } |