From: "Eregon (Benoit Daloze)" Date: 2021-11-27T18:56:47+00:00 Subject: [ruby-core:106297] [Ruby master Feature#18364] Add GC.stat_size_pool for Variable Width Allocation Issue #18364 has been updated by Eregon (Benoit Daloze). There is something maybe related in TruffleRuby and JRuby, where we have per-heap information. Maybe it would make sense to have a unified interface for per-heap information? TruffleRuby: ``` $ ruby -e 'pp GC.heap_stats' {:time=>29, :count=>4, :minor_gc_count=>4, :major_gc_count=>0, :unknown_count=>0, :used=>26931712, :heap_live_slots=>26931712, :committed=>530579456, :heap_available_slots=>530579456, :heap_free_slots=>503647744, :init=>526385152, :max=>8420065280, "G1 Eden Space"=> {:used=>0, :committed=>75497472, :init=>27262976, :max=>-1, :peak_used=>46137344, :peak_committed=>327155712, :peak_init=>27262976, :peak_max=>-1, :last_used=>0, :last_committed=>75497472, :last_init=>27262976, :last_max=>-1}, :peak_used=>73069056, :peak_committed=>834666496, :peak_init=>526385152, :peak_max=>8420065278, :last_used=>8388608, :last_committed=>83886080, :last_init=>526385152, :last_max=>8420065278, "G1 Survivor Space"=> {:used=>8388608, :committed=>8388608, :init=>0, :max=>-1, :peak_used=>8388608, :peak_committed=>8388608, :peak_init=>0, :peak_max=>-1, :last_used=>8388608, :last_committed=>8388608, :last_init=>0, :last_max=>-1}, "G1 Old Gen"=> {:used=>18543104, :committed=>446693376, :init=>499122176, :max=>8420065280, :peak_used=>18543104, :peak_committed=>499122176, :peak_init=>499122176, :peak_max=>8420065280, :last_used=>0, :last_committed=>0, :last_init=>499122176, :last_max=>8420065280}} ``` JRuby: ``` ruby -e 'pp GC.stat' {:count=>2, :time=>17, :committed=>1061158912.0, :init=>1052770304.0, :max=>16840130556.0, :used=>44554240.0, :peak_committed=>1660944384.0, :peak_init=>1052770304.0, :peak_max=>16840130556.0, :peak_used=>65525760.0, :last_committed=>79691776.0, :last_init=>1052770304.0, :last_max=>16840130556.0, :last_used=>8388608.0, "G1 Young Generation"=> {:count=>2, :time=>17, :pools=> {"G1 Old Gen"=> {:committed=>490733568, :init=>499122176, :max=>8420065280, :used=>7597056, :peak_committed=>499122176, :peak_init=>499122176, :peak_max=>8420065280, :peak_used=>7597056, :last_committed=>0, :last_init=>499122176, :last_max=>8420065280, :last_used=>0}}}, "G1 Old Generation"=> {:count=>0, :time=>0, :pools=> {"G1 Old Gen"=> {:committed=>490733568, :init=>499122176, :max=>8420065280, :used=>7597056, :peak_committed=>499122176, :peak_init=>499122176, :peak_max=>8420065280, :peak_used=>7597056, :last_committed=>0, :last_init=>499122176, :last_max=>8420065280, :last_used=>0}}}} ``` ---------------------------------------- Feature #18364: Add GC.stat_size_pool for Variable Width Allocation https://bugs.ruby-lang.org/issues/18364#change-94923 * Author: peterzhu2118 (Peter Zhu) * Status: Open * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) ---------------------------------------- # GitHub PR: https://github.com/ruby/ruby/pull/5177 We're proposing an API to get statistics for size pools for Variable Width Allocation similar to `GC.stat`. This will make it easier for us (and other developers) to tune VWA. Before 3.1 release, we plan to keep this method hidden from the documentation using `:nodoc:` since it is not useful when not using VWA. For example: ```ruby # Get stats for size pool 2 puts GC.stat_size_pool(2) #=> {:slot_size=>160, :heap_allocatable_pages=>80, :heap_eden_pages=>14, :heap_eden_slots=>1424, :heap_tomb_pages=>0, :heap_tomb_slots=>0} puts GC.stat_size_pool(2, :heap_eden_pages) #=> 14 ``` We aim to keep the keys in the outputted hash the same as the keys used in `GC.stat`. We chose to implement a new method instead of re-using an existing API (`GC.stat`) because the keys returned by `GC.stat_size_pool` will not be the same as `GC.stat`. We believe that having `GC.stat` return different shapes of hashes based on its arguments is confusing. -- https://bugs.ruby-lang.org/ Unsubscribe: