[project @ 2004-08-13 13:04:50 by simonmar]
[ghc-hetmet.git] / ghc / includes / RtsFlags.h
index 4e1bcc1..1d45748 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsFlags.h,v 1.37 2001/08/08 14:14:09 simonmar Exp $
+ * $Id: RtsFlags.h,v 1.46 2004/08/13 13:09:29 simonmar Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -10,6 +10,8 @@
 #ifndef RTSFLAGS_H
 #define RTSFLAGS_H
 
+#include <stdio.h>
+
 /* For defaults, see the @initRtsFlagsDefaults@ routine. */
 
 struct GC_FLAGS {
@@ -42,37 +44,24 @@ struct GC_FLAGS {
     rtsBool frontpanel;
 };
 
-/* Hack: this struct uses bitfields so that we can use a binary arg
- * with the -D flag.
- * Remember to update the corresponding bit of RtsFlags.c if you
- * change/extend this struct.
- */
 struct DEBUG_FLAGS {  
-  /* flags to control debugging output in various subsystems */
-  rtsBool scheduler   : 1; /*  1 */
-  rtsBool evaluator   : 1; /*  2 */
-  rtsBool codegen     : 1; /*  4 */
-  rtsBool weak        : 1; /*  8 */
-  rtsBool gccafs      : 1; /* 16 */
-  rtsBool gc          : 1; /* 32 */
-  rtsBool block_alloc : 1; /* 64 */
-
-  /* flags to control consistency checking (often very expensive!) */
-  rtsBool sanity      : 1; /* 128 */
-
-  rtsBool stable      : 1; /* 256 */
-  rtsBool prof        : 1; /* 512 */
-  rtsBool gran        : 1; /* 1024 */
-  rtsBool par         : 1; /* 2048 */
-
-  /* The object linker */
-  rtsBool linker      : 1; /* 4096 */
+    // flags to control debugging output & extra checking in various subsystems
+    rtsBool scheduler;      // 's'
+    rtsBool interpreter;    // 'i'
+    rtsBool codegen;        // 'c'
+    rtsBool weak;           // 'w'
+    rtsBool gccafs;         // 'G'
+    rtsBool gc;             // 'g'
+    rtsBool block_alloc;    // 'b'
+    rtsBool sanity;         // 'S'   warning: might be expensive!
+    rtsBool stable;         // 't'
+    rtsBool prof;           // 'p'
+    rtsBool gran;           // 'r'
+    rtsBool par;            // 'P'
+    rtsBool linker;         // 'l'   the object linker
+    rtsBool apply;          // 'a'
 };
 
-#define MAX_DEBUG_OPTION     12
-#define DEBUG_MASK(n)        ((nat)(ldexp(1,n)))
-#define MAX_DEBUG_MASK       ((nat)(ldexp(1,(MAX_DEBUG_OPTION+1))-1))
-
 struct COST_CENTRE_FLAGS {
     unsigned int           doCostCentres;
 # define COST_CENTRES_SUMMARY  1
@@ -84,43 +73,37 @@ struct COST_CENTRE_FLAGS {
     int            msecsPerTick;    /* derived */
 };
 
-#ifdef PROFILING
 struct PROFILING_FLAGS {
     unsigned int       doHeapProfile;
-
-    nat                 profileFrequency;  /* how often do you want */
-                                           /* to sample (in ms) */
-
-
 # define NO_HEAP_PROFILING     0       /* N.B. Used as indexes into arrays */
 # define HEAP_BY_CCS           1
 # define HEAP_BY_MOD           2
 # define HEAP_BY_DESCR         4
 # define HEAP_BY_TYPE          5
+# define HEAP_BY_RETAINER       6
+# define HEAP_BY_LDV            7
+
+# define HEAP_BY_INFOPTR        1      /* DEBUG only */
+# define HEAP_BY_CLOSURE_TYPE   2      /* DEBUG only */
+
+    nat                 profileInterval;      /* delta between samples (in ms) */
+    nat                 profileIntervalTicks; /* delta between samples (in 'ticks') */
+    rtsBool             includeTSOs;
+
 
     rtsBool            showCCSOnException;
-  
-# define CCchar    'C'
-# define MODchar   'M'
-# define DESCRchar 'D'
-# define TYPEchar  'Y'
+
+    nat                 maxRetainerSetSize;
 
     char*               modSelector;
     char*               descrSelector;
     char*               typeSelector;
     char*               ccSelector;
-
-
-};
-#elif defined(DEBUG)
-# define NO_HEAP_PROFILING     0
-# define HEAP_BY_INFOPTR        1
-# define HEAP_BY_CLOSURE_TYPE   2
-struct PROFILING_FLAGS {
-    unsigned int  doHeapProfile;     /* heap profile using symbol table */
+    char*               ccsSelector;
+    char*               retainerSelector;
+    char*               bioSelector;
 
 };
-#endif /* DEBUG || PROFILING */
 
 struct CONCURRENT_FLAGS {
     int ctxtSwitchTime;                /* in milliseconds */
@@ -297,42 +280,38 @@ struct GRAN_FLAGS {
 };
 #endif /* GRAN */
 
-#ifdef TICKY_TICKY
 struct TICKY_FLAGS {
     rtsBool showTickyStats;
     FILE   *tickyFile;
 };
-#endif /* TICKY_TICKY */
 
 
 /* Put them together: */
 
-struct RTS_FLAGS {
-    struct GC_FLAGS    GcFlags;
-    struct DEBUG_FLAGS DebugFlags;
-    struct CONCURRENT_FLAGS ConcFlags;
-
-#if defined(PROFILING) || defined(PAR)
+typedef struct _RTS_FLAGS {
+       // The first portion of RTS_FLAGS is invariant.
+    struct GC_FLAGS         GcFlags;
+    struct CONCURRENT_FLAGS  ConcFlags;
+    struct DEBUG_FLAGS      DebugFlags;
     struct COST_CENTRE_FLAGS CcFlags;
-#endif
-#if defined(PROFILING) || defined(DEBUG)
-    struct PROFILING_FLAGS ProfFlags;
-#endif
+    struct PROFILING_FLAGS   ProfFlags;
+    struct TICKY_FLAGS      TickyFlags;
+
 #if defined(SMP) || defined(PAR)
     struct PAR_FLAGS   ParFlags;
 #endif
 #ifdef GRAN
     struct GRAN_FLAGS  GranFlags;
 #endif
-#ifdef TICKY_TICKY
-    struct TICKY_FLAGS TickyFlags;
-#endif
-};
+} RTS_FLAGS;
 
 #ifdef COMPILING_RTS_MAIN
-extern DLLIMPORT struct RTS_FLAGS RtsFlags;
+extern DLLIMPORT RTS_FLAGS RtsFlags;
+#elif IN_STG_CODE
+// Hack because the C code generator can't generate '&label'.
+extern RTS_FLAGS RtsFlags[];
 #else
-extern struct RTS_FLAGS RtsFlags;
+extern RTS_FLAGS RtsFlags;
 #endif
 
 /* Routines that operate-on/to-do-with RTS flags: */