1 /* -----------------------------------------------------------------------------
3 * (c) The GHC Team, 1998-2009
5 * Datatypes that holds the command-line flag settings.
7 * Do not #include this file directly: #include "Rts.h" instead.
9 * To understand the structure of the RTS headers, see the wiki:
10 * http://hackage.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes
12 * ---------------------------------------------------------------------------*/
19 /* For defaults, see the @initRtsFlagsDefaults@ routine. */
25 #define COLLECT_GC_STATS 1
26 #define ONELINE_GC_STATS 2
27 #define SUMMARY_GC_STATS 3
28 #define VERBOSE_GC_STATS 4
30 nat maxStkSize; /* in *words* */
31 nat initialStkSize; /* in *words* */
33 nat maxHeapSize; /* in *blocks* */
34 nat minAllocAreaSize; /* in *blocks* */
35 nat minOldGenSize; /* in *blocks* */
36 nat heapSizeSuggestion; /* in *blocks* */
42 rtsBool squeezeUpdFrames;
44 rtsBool compact; /* True <=> "compact all the time" */
45 double compactThreshold;
47 rtsBool sweep; /* use "mostly mark-sweep" instead of copying
48 * for the oldest generation */
52 int idleGCDelayTime; /* in milliseconds */
54 StgWord heapBase; /* address to ask the OS for memory */
58 /* flags to control debugging output & extra checking in various subsystems */
59 rtsBool scheduler; /* 's' */
60 rtsBool interpreter; /* 'i' */
61 rtsBool weak; /* 'w' */
62 rtsBool gccafs; /* 'G' */
64 rtsBool block_alloc; /* 'b' */
65 rtsBool sanity; /* 'S' warning: might be expensive! */
66 rtsBool stable; /* 't' */
67 rtsBool prof; /* 'p' */
68 rtsBool eventlog; /* 'e' */
69 rtsBool linker; /* 'l' the object linker */
70 rtsBool apply; /* 'a' */
71 rtsBool stm; /* 'm' */
72 rtsBool squeeze; /* 'z' stack squeezing & lazy blackholing */
73 rtsBool hpc; /* 'c' coverage */
74 rtsBool timestamp; /* add timestamps to traces */
77 struct COST_CENTRE_FLAGS {
78 unsigned int doCostCentres;
79 # define COST_CENTRES_SUMMARY 1
80 # define COST_CENTRES_VERBOSE 2 /* incl. serial time profile */
81 # define COST_CENTRES_ALL 3
82 # define COST_CENTRES_XML 4
84 int profilerTicks; /* derived */
85 int msecsPerTick; /* derived */
88 struct PROFILING_FLAGS {
89 unsigned int doHeapProfile;
90 # define NO_HEAP_PROFILING 0 /* N.B. Used as indexes into arrays */
91 # define HEAP_BY_CCS 1
92 # define HEAP_BY_MOD 2
93 # define HEAP_BY_DESCR 4
94 # define HEAP_BY_TYPE 5
95 # define HEAP_BY_RETAINER 6
96 # define HEAP_BY_LDV 7
98 # define HEAP_BY_CLOSURE_TYPE 8
100 nat profileInterval; /* delta between samples (in ms) */
101 nat profileIntervalTicks; /* delta between samples (in 'ticks') */
105 rtsBool showCCSOnException;
107 nat maxRetainerSetSize;
116 char* retainerSelector;
122 struct EVENTLOG_FLAGS {
123 rtsBool doEventLogging;
127 struct CONCURRENT_FLAGS {
128 int ctxtSwitchTime; /* in milliseconds */
129 int ctxtSwitchTicks; /* derived */
133 int tickInterval; /* in milliseconds */
134 rtsBool install_signal_handlers;
135 rtsBool machineReadable;
136 StgWord linkerMemBase; /* address to ask the OS for memory
137 * for the linker, NULL ==> off */
142 nat nNodes; /* number of threads to run simultaneously */
143 rtsBool migrate; /* migrate threads between capabilities */
144 rtsBool wakeupMigrate; /* migrate a thread on wakeup */
145 unsigned int maxLocalSparks;
146 rtsBool parGcEnabled; /* enable parallel GC */
147 rtsBool parGcGen; /* do parallel GC in this generation
149 rtsBool parGcLoadBalancing; /* do load-balancing in parallel GC */
150 rtsBool setAffinity; /* force thread affinity with CPUs */
152 #endif /* THREADED_RTS */
155 rtsBool showTickyStats;
160 #define MAX_PAPI_USER_EVENTS 8
163 nat eventType; /* The type of events to count */
165 char * userEvents[MAX_PAPI_USER_EVENTS];
168 #define PAPI_FLAG_CACHE_L1 1
169 #define PAPI_FLAG_CACHE_L2 2
170 #define PAPI_FLAG_BRANCH 3
171 #define PAPI_FLAG_STALLS 4
172 #define PAPI_FLAG_CB_EVENTS 5
173 #define PAPI_USER_EVENTS 6
177 /* Put them together: */
179 typedef struct _RTS_FLAGS {
180 /* The first portion of RTS_FLAGS is invariant. */
181 struct GC_FLAGS GcFlags;
182 struct CONCURRENT_FLAGS ConcFlags;
183 struct MISC_FLAGS MiscFlags;
184 struct DEBUG_FLAGS DebugFlags;
185 struct COST_CENTRE_FLAGS CcFlags;
186 struct PROFILING_FLAGS ProfFlags;
188 struct EVENTLOG_FLAGS EventLogFlags;
190 struct TICKY_FLAGS TickyFlags;
192 #if defined(THREADED_RTS)
193 struct PAR_FLAGS ParFlags;
196 struct PAPI_FLAGS PapiFlags;
200 #ifdef COMPILING_RTS_MAIN
201 extern DLLIMPORT RTS_FLAGS RtsFlags;
203 /* Hack because the C code generator can't generate '&label'. */
204 extern RTS_FLAGS RtsFlags[];
206 extern RTS_FLAGS RtsFlags;
209 /* Routines that operate-on/to-do-with RTS flags: */
211 void initRtsFlagsDefaults(void);
212 void setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]);
213 void setProgName(char *argv[]);
217 * The printf formats are here, so we are less likely to make
218 * overly-long filenames (with disastrous results). No more than 128
222 #define STATS_FILENAME_MAXLEN 128
224 #define GR_FILENAME_FMT "%0.124s.gr"
225 #define GR_FILENAME_FMT_GUM "%0.120s.%03d.%s"
226 #define HP_FILENAME_FMT "%0.124s.hp"
227 #define LIFE_FILENAME_FMT "%0.122s.life"
228 #define PROF_FILENAME_FMT "%0.122s.prof"
229 #define PROF_FILENAME_FMT_GUM "%0.118s.%03d.prof"
230 #define QP_FILENAME_FMT "%0.124s.qp"
231 #define STAT_FILENAME_FMT "%0.122s.stat"
232 #define TICKY_FILENAME_FMT "%0.121s.ticky"
233 #define TIME_FILENAME_FMT "%0.122s.time"
234 #define TIME_FILENAME_FMT_GUM "%0.118s.%03d.time"
236 /* an "int" so as to match normal "argc" */
237 /* Now defined in Stg.h (lib/std/cbits need these too.)
238 extern int prog_argc;
239 extern char **prog_argv;
241 extern int rts_argc; /* ditto */
242 extern char *rts_argv[];
244 #endif /* RTS_FLAGS_H */