summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2014-11-21 18:58:29 -0600
committerAustin Seipp <austin@well-typed.com>2014-11-24 09:43:26 -0600
commit1617a10aaa75567b776d4a47200ddaa1267771db (patch)
tree1e2814143984473e332de14ab5f0560dab889af2 /includes
parenta7c29721535d636fb16ab756b3f44224e04a5113 (diff)
downloadhaskell-1617a10aaa75567b776d4a47200ddaa1267771db.tar.gz
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
Diffstat (limited to 'includes')
-rw-r--r--includes/rts/Flags.h78
1 files changed, 48 insertions, 30 deletions
diff --git a/includes/rts/Flags.h b/includes/rts/Flags.h
index ec542701df..b707a20edc 100644
--- a/includes/rts/Flags.h
+++ b/includes/rts/Flags.h
@@ -18,7 +18,14 @@
/* For defaults, see the @initRtsFlagsDefaults@ routine. */
-struct GC_FLAGS {
+/* Note [Synchronization of flags and base APIs]
+ *
+ * We provide accessors to RTS flags in base. (GHC.RTS module)
+ * The API should be updated whenever RTS flags are modified.
+ */
+
+/* See Note [Synchronization of flags and base APIs] */
+typedef struct _GC_FLAGS {
FILE *statsFile;
nat giveStats;
#define NO_GC_STATS 0
@@ -64,9 +71,10 @@ struct GC_FLAGS {
* to handle the exception before we
* raise it again.
*/
-};
+} GC_FLAGS;
-struct DEBUG_FLAGS {
+/* See Note [Synchronization of flags and base APIs] */
+typedef struct _DEBUG_FLAGS {
/* flags to control debugging output & extra checking in various subsystems */
rtsBool scheduler; /* 's' */
rtsBool interpreter; /* 'i' */
@@ -83,10 +91,12 @@ struct DEBUG_FLAGS {
rtsBool squeeze; /* 'z' stack squeezing & lazy blackholing */
rtsBool hpc; /* 'c' coverage */
rtsBool sparks; /* 'r' */
-};
+} DEBUG_FLAGS;
-struct COST_CENTRE_FLAGS {
+/* See Note [Synchronization of flags and base APIs] */
+typedef struct _COST_CENTRE_FLAGS {
nat doCostCentres;
+# define COST_CENTRES_NONE 0
# define COST_CENTRES_SUMMARY 1
# define COST_CENTRES_VERBOSE 2 /* incl. serial time profile */
# define COST_CENTRES_ALL 3
@@ -94,9 +104,10 @@ struct COST_CENTRE_FLAGS {
int profilerTicks; /* derived */
int msecsPerTick; /* derived */
-};
+} COST_CENTRE_FLAGS;
-struct PROFILING_FLAGS {
+/* See Note [Synchronization of flags and base APIs] */
+typedef struct _PROFILING_FLAGS {
nat doHeapProfile;
# define NO_HEAP_PROFILING 0 /* N.B. Used as indexes into arrays */
# define HEAP_BY_CCS 1
@@ -127,13 +138,14 @@ struct PROFILING_FLAGS {
char* retainerSelector;
char* bioSelector;
-};
+} PROFILING_FLAGS;
#define TRACE_NONE 0
#define TRACE_EVENTLOG 1
#define TRACE_STDERR 2
-struct TRACE_FLAGS {
+/* See Note [Synchronization of flags and base APIs] */
+typedef struct _TRACE_FLAGS {
int tracing;
rtsBool timestamp; /* show timestamp in stderr output */
rtsBool scheduler; /* trace scheduler events */
@@ -141,12 +153,13 @@ struct TRACE_FLAGS {
rtsBool sparks_sampled; /* trace spark events by a sampled method */
rtsBool sparks_full; /* trace spark events 100% accurately */
rtsBool user; /* trace user events (emitted from Haskell code) */
-};
+} TRACE_FLAGS;
-struct CONCURRENT_FLAGS {
+/* See Note [Synchronization of flags and base APIs] */
+typedef struct _CONCURRENT_FLAGS {
Time ctxtSwitchTime; /* units: TIME_RESOLUTION */
int ctxtSwitchTicks; /* derived */
-};
+} CONCURRENT_FLAGS;
/*
* The tickInterval is the time interval between "ticks", ie.
@@ -157,16 +170,18 @@ struct CONCURRENT_FLAGS {
*/
#define DEFAULT_TICK_INTERVAL USToTime(10000)
-struct MISC_FLAGS {
+/* See Note [Synchronization of flags and base APIs] */
+typedef struct _MISC_FLAGS {
Time tickInterval; /* units: TIME_RESOLUTION */
rtsBool install_signal_handlers;
rtsBool machineReadable;
StgWord linkerMemBase; /* address to ask the OS for memory
* for the linker, NULL ==> off */
-};
+} MISC_FLAGS;
#ifdef THREADED_RTS
-struct PAR_FLAGS {
+/* See Note [Synchronization of flags and base APIs] */
+typedef struct _PAR_FLAGS {
nat nNodes; /* number of threads to run simultaneously */
rtsBool migrate; /* migrate threads between capabilities */
nat maxLocalSparks;
@@ -188,24 +203,26 @@ struct PAR_FLAGS {
* (zero disables) */
rtsBool setAffinity; /* force thread affinity with CPUs */
-};
+} PAR_FLAGS;
#endif /* THREADED_RTS */
-struct TICKY_FLAGS {
+/* See Note [Synchronization of flags and base APIs] */
+typedef struct _TICKY_FLAGS {
rtsBool showTickyStats;
FILE *tickyFile;
-};
+} TICKY_FLAGS;
#ifdef USE_PAPI
#define MAX_PAPI_USER_EVENTS 8
-struct PAPI_FLAGS {
+/* See Note [Synchronization of flags and base APIs] */
+typedef struct _PAPI_FLAGS {
nat eventType; /* The type of events to count */
nat numUserEvents;
char * userEvents[MAX_PAPI_USER_EVENTS];
/* Allow user to enter either PAPI preset or native events */
nat userEventsKind[MAX_PAPI_USER_EVENTS];
-};
+} PAPI_FLAGS;
#define PAPI_FLAG_CACHE_L1 1
#define PAPI_FLAG_CACHE_L2 2
@@ -220,22 +237,23 @@ struct PAPI_FLAGS {
/* Put them together: */
+/* See Note [Synchronization of flags and base APIs] */
typedef struct _RTS_FLAGS {
/* The first portion of RTS_FLAGS is invariant. */
- struct GC_FLAGS GcFlags;
- struct CONCURRENT_FLAGS ConcFlags;
- struct MISC_FLAGS MiscFlags;
- struct DEBUG_FLAGS DebugFlags;
- struct COST_CENTRE_FLAGS CcFlags;
- struct PROFILING_FLAGS ProfFlags;
- struct TRACE_FLAGS TraceFlags;
- struct TICKY_FLAGS TickyFlags;
+ GC_FLAGS GcFlags;
+ CONCURRENT_FLAGS ConcFlags;
+ MISC_FLAGS MiscFlags;
+ DEBUG_FLAGS DebugFlags;
+ COST_CENTRE_FLAGS CcFlags;
+ PROFILING_FLAGS ProfFlags;
+ TRACE_FLAGS TraceFlags;
+ TICKY_FLAGS TickyFlags;
#if defined(THREADED_RTS)
- struct PAR_FLAGS ParFlags;
+ PAR_FLAGS ParFlags;
#endif
#ifdef USE_PAPI
- struct PAPI_FLAGS PapiFlags;
+ PAPI_FLAGS PapiFlags;
#endif
} RTS_FLAGS;