diff options
author | Takashi Kokubun <[email protected]> | 2022-11-15 15:20:02 -0800 |
---|---|---|
committer | GitHub <[email protected]> | 2022-11-15 15:20:02 -0800 |
commit | 0d384ce6e627539d17f9307e522cb98bbca1ace3 (patch) | |
tree | 73cb77b66e605e7706b9d6c15e496e59f210d15e | |
parent | d1fb6595475707986356fd2533fa3f2a650ea39b (diff) |
YJIT: Include actual memory region size in stats (#6736)
Notes
Notes:
Merged-By: k0kubun <[email protected]>
-rw-r--r-- | yjit.rb | 1 | ||||
-rw-r--r-- | yjit/src/asm/mod.rs | 7 | ||||
-rw-r--r-- | yjit/src/stats.rs | 3 |
3 files changed, 9 insertions, 2 deletions
@@ -262,6 +262,7 @@ module RubyVM::YJIT $stderr.puts "inline_code_size: " + ("%10d" % stats[:inline_code_size]) $stderr.puts "outlined_code_size: " + ("%10d" % stats[:outlined_code_size]) $stderr.puts "freed_code_size: " + ("%10d" % stats[:freed_code_size]) + $stderr.puts "code_region_size: " + ("%10d" % stats[:code_region_size]) $stderr.puts "yjit_alloc_size: " + ("%10d" % stats[:yjit_alloc_size]) if stats.key?(:yjit_alloc_size) $stderr.puts "live_page_count: " + ("%10d" % stats[:live_page_count]) $stderr.puts "freed_page_count: " + ("%10d" % stats[:freed_page_count]) 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()); |