Opened 4 years ago

Closed 5 months ago

#5364 closed feature request (fixed)

Access RTS flag values from inside Haskell programs

Reported by: ezyang Owned by: ekmett
Priority: normal Milestone: 7.10.1
Component: Core Libraries Version: 7.3
Keywords: Cc: johan.tibell@…, hvr, core-libraries-committee@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: #10022 Differential Revisions: Phab:D306

Description (last modified by ezyang)

Strictly speaking, it is already possible to do this since includes/rts/Flags.h exports RtsFlags, which can be accessed with a mini wrapper function. We should add this wrapper function so we can import it, and then write code which reads out the contents of all the various parameters so that users can introspect this at runtime. Maybe put them in the GHC.RTS module.

Change History (12)

comment:1 Changed 4 years ago by igloo

  • Milestone set to 7.6.1

comment:2 Changed 3 years ago by tibbe

  • Cc johan.tibell@… added

comment:3 Changed 3 years ago by igloo

  • Milestone changed from 7.6.1 to 7.6.2

comment:4 Changed 15 months ago by ezyang

  • Cc hvr added
  • Description modified (diff)
  • difficulty set to Unknown

comment:5 Changed 12 months ago by thoughtpolice

  • Milestone changed from 7.6.2 to 7.10.1

Moving to 7.10.1.

comment:6 Changed 9 months ago by thoughtpolice

  • Component changed from libraries/base to Core Libraries
  • Owner set to ekmett

Moving over to new owning component 'Core Libraries'.

comment:7 Changed 8 months ago by thomie

  • Cc core-libraries-committee@… added
  • Differential Revisions set to Phab:D306

comment:8 Changed 7 months ago by Austin Seipp <austin@…>

In 1617a10aaa75567b776d4a47200ddaa1267771db/ghc:

accessors to RTS flag values -- #5364

Summary: Implementation of #5364. Mostly boilerplate, reading FILE fields is missing.

Test Plan:
- Get some feedback on missing parts. (FILE fields)
- Get some feedback on module name.
- Get some feedback on other things.
- Get code reviewed.
- Make sure test suite is passing. (I haven't run it myself)

Reviewers: hvr, austin, ezyang

Reviewed By: ezyang

Subscribers: ekmett, simonmar, ezyang, carter, thomie

Differential Revision: https://phabricator.haskell.org/D306

GHC Trac Issues: #5364

Conflicts:
	includes/rts/Flags.h

comment:9 Changed 6 months ago by thoughtpolice

  • Milestone changed from 7.10.1 to 7.12.1

Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

comment:10 Changed 6 months ago by Herbert Valerio Riedel <hvr@…>

In 40561cd235f07d41904d2604ff7f0c942af4d35e/ghc:

Fix `heapSizeSuggesionAuto` typo (#9934)

This was introduced in 1617a10a (re #5364)

comment:11 Changed 6 months ago by hvr

  • Milestone changed from 7.12.1 to 7.10.1

btw, I noticed that the API exposed by GHC.RTS.Flags varies depending on unsigned int:

-- | @'nat'@ defined in @rts/Types.h@
type Nat = #{type unsigned int}

data GCFlags = GCFlags
    { statsFile             :: Maybe FilePath
    , giveStats             :: GiveGCStats
    , maxStkSize            :: Nat
    , initialStkSize        :: Nat
    , stkChunkSize          :: Nat
...

Is this really a good idea rather simply using Word which I assume should always be large enough to contain the range of CULong?

Moreover, shouldn't most of those small-fields be !-ed to avoid thunks and unecessary pointer chasing?

comment:12 Changed 5 months ago by thoughtpolice

  • Resolution set to fixed
  • Status changed from new to closed

Yes, we should make those cleanups. I've filed another ticket: #10022. However, this ticket is (in general) worth closing.

Note: See TracTickets for help on using tickets.