summaryrefslogtreecommitdiff
path: root/yjit
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-11-15 15:20:02 -0800
committerGitHub <noreply@github.com>2022-11-15 15:20:02 -0800
commit0d384ce6e627539d17f9307e522cb98bbca1ace3 (patch)
tree73cb77b66e605e7706b9d6c15e496e59f210d15e /yjit
parentd1fb6595475707986356fd2533fa3f2a650ea39b (diff)
YJIT: Include actual memory region size in stats (#6736)
Notes
Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
Diffstat (limited to 'yjit')
-rw-r--r--yjit/src/asm/mod.rs7
-rw-r--r--yjit/src/stats.rs3
2 files changed, 8 insertions, 2 deletions
diff --git a/yjit/src/asm/mod.rs b/yjit/src/asm/mod.rs
index 4f3d20f5e5..728444b281 100644
--- a/yjit/src/asm/mod.rs
+++ b/yjit/src/asm/mod.rs
@@ -210,12 +210,15 @@ impl CodeBlock {
self.page_size
}
+ pub fn mapped_region_size(&self) -> usize {
+ self.mem_block.borrow().mapped_region_size()
+ }
+
/// Return the number of code pages that have been mapped by the VirtualMemory.
pub fn num_mapped_pages(&self) -> usize {
- let mapped_region_size = self.mem_block.borrow().mapped_region_size();
// CodeBlock's page size != VirtualMem's page size on Linux,
// so mapped_region_size % self.page_size may not be 0
- ((mapped_region_size - 1) / self.page_size) + 1
+ ((self.mapped_region_size() - 1) / self.page_size) + 1
}
/// Return the number of code pages that have been reserved by the VirtualMemory.
diff --git a/yjit/src/stats.rs b/yjit/src/stats.rs
index cfce4c9c33..f3d01a120e 100644
--- a/yjit/src/stats.rs
+++ b/yjit/src/stats.rs
@@ -402,6 +402,9 @@ fn rb_yjit_gen_stats_dict() -> VALUE {
// Code GC count
hash_aset_usize!(hash, "code_gc_count", CodegenGlobals::get_code_gc_count());
+ // Size of memory region allocated for JIT code
+ hash_aset_usize!(hash, "code_region_size", cb.mapped_region_size());
+
// Rust global allocations in bytes
#[cfg(feature="stats")]
hash_aset_usize!(hash, "yjit_alloc_size", global_allocation_size());