diff options
author | Maxime Chevalier-Boisvert <[email protected]> | 2024-06-12 13:33:27 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2024-06-12 13:33:27 -0400 |
commit | ce06924a17176d18816d968867858f97401d7c82 (patch) | |
tree | 9cf636b18f7f17061816a6910b8e6874e29ff838 /yjit/src | |
parent | 85190d41307525063d9963283d5813074dda793f (diff) |
YJIT: add context cache hits stat (#10979)
* YJIT: add context cache hits stat
This stat should make more sense when it comes to interpreting
the effectiveness of the cache on large deployed apps.
Diffstat (limited to 'yjit/src')
-rw-r--r-- | yjit/src/core.rs | 2 | ||||
-rw-r--r-- | yjit/src/stats.rs | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/yjit/src/core.rs b/yjit/src/core.rs index 397ebb4566..244b03a565 100644 --- a/yjit/src/core.rs +++ b/yjit/src/core.rs @@ -858,10 +858,12 @@ impl Context { incr_counter!(num_contexts_encoded); if *self == Context::default() { + incr_counter!(context_cache_hits); return 0; } if let Some(idx) = Self::cache_get(self) { + incr_counter!(context_cache_hits); debug_assert!(Self::decode(idx) == *self); return idx; } diff --git a/yjit/src/stats.rs b/yjit/src/stats.rs index 96c501abe3..59b2d05f0e 100644 --- a/yjit/src/stats.rs +++ b/yjit/src/stats.rs @@ -266,7 +266,7 @@ 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; 18] = [ +pub const DEFAULT_COUNTERS: [Counter; 19] = [ Counter::code_gc_count, Counter::compiled_iseq_entry, Counter::cold_iseq_entry, @@ -277,6 +277,7 @@ pub const DEFAULT_COUNTERS: [Counter; 18] = [ Counter::compile_time_ns, Counter::max_inline_versions, Counter::num_contexts_encoded, + Counter::context_cache_hits, Counter::invalidation_count, Counter::invalidate_method_lookup, @@ -611,6 +612,8 @@ make_counters! { temp_reg_opnd, temp_mem_opnd, temp_spill, + + context_cache_hits, } //=========================================================================== |