aboutsummaryrefslogtreecommitdiffstats
path: root/yjit
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2023-10-18 19:46:35 -0400
committerGitHub <noreply@github.com>2023-10-18 23:46:35 +0000
commitd2b0c9da2e0148c8c12ca58e21c482c1e66c2358 (patch)
tree7f0ae18acae1a6d389b449498175cdf82bd66e20 /yjit
parent0ac6fb225d15cbcd35b8122b151a17eaa92fafaf (diff)
downloadruby-d2b0c9da2e0148c8c12ca58e21c482c1e66c2358.tar.gz
YJIT: Add a live ISeq counter
It's an estimator for application size and could be used as a compilation heuristic later. Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
Diffstat (limited to 'yjit')
-rw-r--r--yjit/src/stats.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/yjit/src/stats.rs b/yjit/src/stats.rs
index 7d44b388cd..d35cdc22a4 100644
--- a/yjit/src/stats.rs
+++ b/yjit/src/stats.rs
@@ -14,6 +14,10 @@ use crate::cruby::*;
use crate::options::*;
use crate::yjit::yjit_enabled_p;
+/// A running total of how many ISeqs are in the system.
+#[no_mangle]
+pub static mut rb_yjit_live_iseq_count: u64 = 0;
+
/// A middleware to count Rust-allocated bytes as yjit_alloc_size.
#[global_allocator]
static GLOBAL_ALLOCATOR: StatsAlloc = StatsAlloc { alloc_size: AtomicUsize::new(0) };
@@ -635,6 +639,8 @@ fn rb_yjit_gen_stats_dict(context: bool) -> VALUE {
// VM instructions count
hash_aset_usize!(hash, "vm_insns_count", rb_vm_insns_count as usize);
+
+ hash_aset_usize!(hash, "live_iseq_count", rb_yjit_live_iseq_count as usize);
}
// If we're not generating stats, put only default counters