From: "Eregon (Benoit Daloze)" Date: 2021-12-14T15:41:06+00:00 Subject: [ruby-core:106659] [Ruby master Feature#18364] Add GC.stat_pool for Variable Width Allocation Issue #18364 has been updated by Eregon (Benoit Daloze). I forgot to mention, I think `GC.stat` is expected to be reasonably fast as e.g. it might be done on every request for monitoring. OTOH capturing per-heap information is typically significantly slower (at least it is on JVM), and so providing that information in a separate method avoids making `GC.stat` slower. peterzhu2118 (Peter Zhu) wrote in #note-14: > If callers want to prevent the probe effect from calls to `GC.stat`, they have to not only create a hash beforehand, but also do a call to `GC.stat`. > Since the first call can trigger GC, I don't think it's unreasonable to also allocate objects. That's a fair point, and probably somewhat already needed as otherwise the Hash will typically need some extra (internal) allocations to fit enough entries. I think we should document this better in the `GC.stat` docs. ---------------------------------------- Feature #18364: Add GC.stat_pool for Variable Width Allocation https://bugs.ruby-lang.org/issues/18364#change-95331 * 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_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_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_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: