[GHC] #15880: GHC.Stats: Add info on amount of pinned memory

#15880: GHC.Stats: Add info on amount of pinned memory -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: task | Status: new Priority: normal | Milestone: 8.6.3 Component: Runtime | Version: 8.6.2 System | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- https://hackage.haskell.org/package/base-4.12.0.0/docs/GHC-Stats.html `GHC.Stats`'s `GCDetails` tells us, separately, the amount of * total heap data (including large objects and compact data) * large ojects * compact data * "Total amount of memory in use by the RTS" (`gcdetails_mem_in_use_bytes`) There currently doesn't seem to be a way to get the amount of pinned memory in use. So some questions: * Is pinned memory accounted for in `gcdetails_mem_in_use_bytes`? * If yes, is it pretty much that value minus `gcdetails_live_bytes`, or are there other memory uses that count to the latter? * If I wanted to add the amount of pinned memory directly to `GHC.Stats`, where would I take that value from? In general, my goal is to collect _all_ easily (cheaply) collectable memory info so that I can add it to `ekg`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15880 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15880: GHC.Stats: Add info on amount of pinned memory -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: task | Status: new Priority: normal | Milestone: 8.6.3 Component: Runtime System | Version: 8.6.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by osa1): To answer the questions: - `gcdetails_mem_in_use_bytes` is simply `mblocks_allocated * MBLOCK_SIZE`. Because pinned memory is also allocated via the block allocator `gcdetails_mem_in_use_bytes` includes pinned memory too. - I don't understand this question. - You'd need to compute this. In the GC once a pinned object block is filled we only distinguish a pinned object block from a large object block in one place, to avoid scavenging pinned blocks. So there's no special accounting for pinned objects. Perhaps you could implement something like `calcTotalLargeObjectsW` by checking if a `BF_LARGE` block is also `BF_PINNED`. If it is then add number of blocks to a counter. Then `num_of_blocks * BLOCK_SIZE` gives you the bytes. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15880#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC