[project @ 1998-11-26 09:17:22 by sof]
[ghc-hetmet.git] / ghc / includes / RtsFlags.lh
1 \begin{code}
2 #ifndef RTSFLAGS_H
3 #define RTSFLAGS_H
4 \end{code}
5
6 For defaults, see the @initRtsFlagsDefaults@ routine.
7
8 \begin{code}
9 struct GC_FLAGS {
10     FILE   *statsFile;
11     I_      giveStats; /* ToDo: replace with enum type? */
12 #define NO_GC_STATS      0
13 #define VERBOSE_GC_STATS 1
14
15     I_      stksSize; /* this size is stored to record number of *words* */
16     I_      heapSize; /* this size is stored to record number of *words* */
17     I_      allocAreaSize;
18     rtsBool allocAreaSizeGiven;
19     I_      specifiedOldGenSize; /* zero => use the rest of the heap */
20     double  pcFreeHeap;
21     I_      minAllocAreaSize; /* derived from: pcFreeHeap, heap-size */
22
23     rtsBool force2s; /* force the use of 2-space copying collection;
24                         forced to rtsTrue if we do *heap* profiling.
25                      */
26     rtsBool forceGC; /* force a major GC every <interval> bytes */
27     I_      forcingInterval; /* actually, stored as a number of *words* */
28     rtsBool ringBell;
29     W_      trace;
30             /* bit  1 set: chatty GC summaries
31                     2 set: details of minor collections
32                     4 set: details of major collections, except marking
33                     8 set: ditto, but marking this time
34                    16 set: GC of ForeignObjs
35                    32 set: GC of Concurrent things
36             */
37 #define DEBUG_TRACE_MINOR_GC     2
38 #define DEBUG_TRACE_MAJOR_GC     4
39 #define DEBUG_TRACE_MARKING      8
40 #define DEBUG_TRACE_FOREIGNOBJS 16
41 #define DEBUG_TRACE_CONCURRENT  32
42
43     rtsBool lazyBlackHoling;
44     rtsBool doSelectorsAtGC;
45     rtsBool squeezeUpdFrames;
46 };
47
48 struct DEBUG_FLAGS {
49 };
50
51 #if defined(PROFILING) || defined(PAR)
52     /* with PROFILING, full cost-centre stuff (also PROFILING_FLAGS);
53        with PAR, just the four fixed cost-centres.
54     */
55 struct COST_CENTRE_FLAGS {
56     W_      doCostCentres;
57 # define COST_CENTRES_SUMMARY   1
58 # define COST_CENTRES_VERBOSE   2 /* incl. serial time profile */
59 # define COST_CENTRES_ALL       3
60
61     char    sortBy;
62 # define SORTCC_LABEL   'C'
63 # define SORTCC_TIME    'T'
64 # define SORTCC_ALLOC   'A'
65
66     I_      ctxtSwitchTicks; /* derived */
67     I_      profilerTicks;   /* derived */
68     I_      msecsPerTick;    /* derived */
69 };
70 #endif
71
72 #ifdef PROFILING
73 struct PROFILING_FLAGS {
74     W_  doHeapProfile;
75 # define NO_HEAP_PROFILING      0       /* N.B. Used as indexes into arrays */
76 # define HEAP_BY_CC             1
77 # define HEAP_BY_MOD            2
78 # define HEAP_BY_GRP            3
79 # define HEAP_BY_DESCR          4
80 # define HEAP_BY_TYPE           5
81 # define HEAP_BY_TIME           6
82   
83 # define CCchar    'C'
84 # define MODchar   'M'
85 # define GRPchar   'G'
86 # define DESCRchar 'D'
87 # define TYPEchar  'Y'
88 # define TIMEchar  'T'
89
90     char *ccSelector;
91     char *modSelector;
92     char *grpSelector;
93     char *descrSelector;
94     char *typeSelector;
95     char *kindSelector;
96 };
97 #endif
98
99 #ifdef CONCURRENT
100 struct CONCURRENT_FLAGS {
101     I_      ctxtSwitchTime; /* in milliseconds */
102     I_      maxThreads;
103     I_      stkChunkSize;
104     I_      maxLocalSparks;
105 };
106 #endif /* CONCURRENT */
107
108 #ifdef PAR
109 struct PAR_FLAGS {
110     rtsBool parallelStats;      /* Gather parallel statistics */
111     rtsBool granSimStats;       /* Full .gr profile (rtsTrue) or only END events? */
112     rtsBool granSimStats_Binary;
113
114     rtsBool outputDisabled;     /* Disable output for performance purposes */
115     
116     W_      packBufferSize;
117 };
118
119 #endif /* PAR */
120
121 #ifdef GRAN
122 struct GRAN_FLAGS {
123     rtsBool granSimStats;  /* Full .gr profile (rtsTrue) or only END events? */
124     rtsBool granSimStats_suppressed; /* No .gr profile at all */
125     rtsBool granSimStats_Binary;
126     rtsBool granSimStats_Sparks;
127     rtsBool granSimStats_Heap;
128     rtsBool labelling;
129     W_      packBufferSize;
130     W_      packBufferSize_internal;
131
132     I_ proc;                      /* number of processors */
133     I_ max_fishes;                /* max number of spark or thread steals */
134     TIME time_slice;              /* max time slice of one reduction thread */
135
136     /* Communication Cost Variables -- set in main program */
137     W_ gran_latency;              /* Latency for single packet */
138     W_ gran_additional_latency;   /* Latency for additional packets */
139     W_ gran_fetchtime;            
140     W_ gran_lunblocktime;         /* Time for local unblock */
141     W_ gran_gunblocktime;         /* Time for global unblock */
142     W_ gran_mpacktime;            /* Cost of creating a packet */     
143     W_ gran_munpacktime;          /* Cost of receiving a packet */    
144     W_ gran_mtidytime;            /* Cost of cleaning up after send */
145
146     W_ gran_threadcreatetime;     /* Thread creation costs */
147     W_ gran_threadqueuetime;      /* Cost of adding a thread to the running/runnable queue */
148     W_ gran_threaddescheduletime; /* Cost of descheduling a thread */
149     W_ gran_threadscheduletime;   /* Cost of scheduling a thread */
150     W_ gran_threadcontextswitchtime;  /* Cost of context switch  */
151
152     /* Instruction Costs */
153     W_ gran_arith_cost;        /* arithmetic instructions (+,i,< etc) */
154     W_ gran_branch_cost;       /* branch instructions */ 
155     W_ gran_load_cost;         /* load into register */
156     W_ gran_store_cost;        /* store into memory */
157     W_ gran_float_cost;        /* floating point operations */
158
159     W_ gran_heapalloc_cost;    /* heap allocation costs */
160
161     /* Overhead for granularity control mechanisms */
162     /* overhead per elem of spark queue */
163     W_ gran_pri_spark_overhead;
164     /* overhead per elem of thread queue */
165     W_ gran_pri_sched_overhead;
166
167     /* GrAnSim-Light: This version puts no bound on the number of
168          processors but in exchange doesn't model communication costs
169          (all communication is 0 cost). Mainly intended to show maximal
170          degree of parallelism in the program (*not* to simulate the
171          execution on a real machine). */
172    
173     rtsBool Light;
174
175     rtsBool DoFairSchedule ;        /* fair scheduling alg? default: unfair */
176     rtsBool DoReScheduleOnFetch ;   /* async. communication? */
177     rtsBool DoStealThreadsFirst;    /* prefer threads over sparks when stealing */
178     rtsBool SimplifiedFetch;        /* fast but inaccurate fetch modelling */
179     rtsBool DoAlwaysCreateThreads;  /* eager thread creation */
180     rtsBool DoGUMMFetching;         /* bulk fetching */
181     rtsBool DoThreadMigration;      /* allow to move threads */
182     I_      FetchStrategy;          /* what to do when waiting for data */
183     rtsBool PreferSparksOfLocalNodes; /* prefer local over global sparks */
184     rtsBool DoPrioritySparking;     /* sparks sorted by priorities */
185     rtsBool DoPriorityScheduling;   /* threads sorted by priorities */
186     I_      SparkPriority;          /* threshold for cut-off mechanism */
187     I_      SparkPriority2;
188     rtsBool RandomPriorities;
189     rtsBool InversePriorities;
190     rtsBool IgnorePriorities;
191     I_      ThunksToPack;           /* number of thunks in packet + 1 */ 
192     rtsBool RandomSteal;            /* steal spark/thread from random proc */
193     rtsBool NoForward;              /* no forwarding of fetch messages */
194     rtsBool PrintFetchMisses;       /* print number of fetch misses */
195
196     W_      debug;
197     rtsBool event_trace;
198     rtsBool event_trace_all;
199    
200 };
201 #endif /* GRAN */
202
203 #ifdef TICKY_TICKY
204 struct TICKY_FLAGS {
205     rtsBool showTickyStats;
206     FILE   *tickyFile;
207
208     /* see also: doUpdEntryCounts in AllFlags */
209 };
210 #endif /* TICKY_TICKY */
211 \end{code}
212
213 Put them together:
214 \begin{code}
215 struct RTS_FLAGS {
216     struct GC_FLAGS     GcFlags;
217     struct DEBUG_FLAGS  DebugFlags; /* unused at present */
218
219 #if defined(PROFILING) || defined(PAR)
220     struct COST_CENTRE_FLAGS CcFlags;
221 #endif
222 #ifdef PROFILING
223     struct PROFILING_FLAGS ProfFlags;
224 #endif
225 #ifdef CONCURRENT
226     struct CONCURRENT_FLAGS ConcFlags;
227 #endif
228 #ifdef PAR
229     struct PAR_FLAGS    ParFlags;
230 #endif
231 #ifdef GRAN
232     struct GRAN_FLAGS   GranFlags;
233 #endif
234 #ifdef TICKY_TICKY
235     struct TICKY_FLAGS  TickyFlags;
236 #endif
237 };
238
239 extern struct RTS_FLAGS RTSflags;
240 \end{code}
241
242 Routines that operate-on/to-do-with RTS flags:
243 \begin{code}
244 void    initRtsFlagsDefaults (STG_NO_ARGS);
245 void    setupRtsFlags PROTO((int *argc,     char *argv[],
246                              int *rts_argc, char *rts_argv[]));
247 \end{code}
248
249 OLD: This is the maximum identifier length that can be used for a cost
250 centre or description string. It includes the terminating null
251 character.
252
253 The printf formats are here, so we are less likely to make overly-long
254 filenames (with disastrous results).  No more than 128 chars, please!
255
256 \begin{code}
257 #define STATS_FILENAME_MAXLEN   128
258
259 #define GR_FILENAME_FMT         "%0.124s.gr"
260 #define GR_FILENAME_FMT_GUM     "%0.120s.%03d.%s"
261 #define HP_FILENAME_FMT         "%0.124s.hp"
262 #define LIFE_FILENAME_FMT       "%0.122s.life"
263 #define PROF_FILENAME_FMT       "%0.122s.prof"
264 #define PROF_FILENAME_FMT_GUM   "%0.118s.%03d.prof"
265 #define QP_FILENAME_FMT         "%0.124s.qp"
266 #define STAT_FILENAME_FMT       "%0.122s.stat"
267 #define TICKY_FILENAME_FMT      "%0.121s.ticky"
268 #define TIME_FILENAME_FMT       "%0.122s.time"
269 #define TIME_FILENAME_FMT_GUM   "%0.118s.%03d.time"
270 \end{code}
271
272 Multi-slurp protection:
273 \begin{code}
274 #endif  /* RTSFLAGS_H */
275 \end{code}