X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FRtsFlags.h;h=7f9a3602256f5090e44090c7cd405a2994c7acae;hb=de896403dfe48bc999e5501eb8b517624dd2e5d4;hp=1939ebef38216f451619ac227c4f55bf43c2d374;hpb=438596897ebbe25a07e1c82085cfbc5bdb00f09e;p=ghc-hetmet.git diff --git a/ghc/rts/RtsFlags.h b/ghc/rts/RtsFlags.h index 1939ebe..7f9a360 100644 --- a/ghc/rts/RtsFlags.h +++ b/ghc/rts/RtsFlags.h @@ -1,5 +1,7 @@ /* ----------------------------------------------------------------------------- - * $Id: RtsFlags.h,v 1.2 1998/12/02 13:28:40 simonm Exp $ + * $Id: RtsFlags.h,v 1.22 2000/03/08 17:48:24 simonmar Exp $ + * + * (c) The GHC Team, 1998-1999 * * Datatypes that holds the command-line flag settings. * @@ -12,20 +14,24 @@ struct GC_FLAGS { FILE *statsFile; - nat giveStats; /* ToDo: replace with enum type? */ + nat giveStats; #define NO_GC_STATS 0 -#define VERBOSE_GC_STATS 1 +#define SUMMARY_GC_STATS 1 +#define VERBOSE_GC_STATS 2 nat maxStkSize; /* in *words* */ nat initialStkSize; /* in *words* */ nat maxHeapSize; /* in *blocks* */ nat minAllocAreaSize; /* in *blocks* */ + nat minOldGenSize; /* in *blocks* */ + nat heapSizeSuggestion; /* in *blocks* */ + double oldGenFactor; double pcFreeHeap; - rtsBool force2s; /* force the use of 2-space copying collection; - forced to rtsTrue if we do *heap* profiling. - */ + nat generations; + nat steps; + rtsBool forceGC; /* force a major GC every bytes */ int forcingInterval; /* actually, stored as a number of *words* */ rtsBool ringBell; @@ -34,7 +40,9 @@ struct GC_FLAGS { }; /* Hack: this struct uses bitfields so that we can use a binary arg - * with the -D flag + * 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 */ @@ -48,6 +56,11 @@ struct DEBUG_FLAGS { /* 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 */ }; #if defined(PROFILING) || defined(PAR) @@ -59,11 +72,7 @@ struct COST_CENTRE_FLAGS { # define COST_CENTRES_SUMMARY 1 # define COST_CENTRES_VERBOSE 2 /* incl. serial time profile */ # define COST_CENTRES_ALL 3 - - char sortBy; -# define SORTCC_LABEL 'C' -# define SORTCC_TIME 'T' -# define SORTCC_ALLOC 'A' +# define COST_CENTRES_XML 4 int ctxtSwitchTicks; /* derived */ int profilerTicks; /* derived */ @@ -74,24 +83,24 @@ struct COST_CENTRE_FLAGS { #ifdef PROFILING struct PROFILING_FLAGS { unsigned int doHeapProfile; + # define NO_HEAP_PROFILING 0 /* N.B. Used as indexes into arrays */ -# define HEAP_BY_CC 1 +# define HEAP_BY_CCS 1 # define HEAP_BY_MOD 2 -# define HEAP_BY_GRP 3 # define HEAP_BY_DESCR 4 # define HEAP_BY_TYPE 5 # define HEAP_BY_TIME 6 + + rtsBool showCCSOnException; # define CCchar 'C' # define MODchar 'M' -# define GRPchar 'G' # define DESCRchar 'D' # define TYPEchar 'Y' # define TIMEchar 'T' char *ccSelector; char *modSelector; - char *grpSelector; char *descrSelector; char *typeSelector; char *kindSelector; @@ -106,69 +115,140 @@ struct PROFILING_FLAGS { #endif /* DEBUG || PROFILING */ struct CONCURRENT_FLAGS { - int ctxtSwitchTime; /* in milliseconds */ - int maxThreads; + int ctxtSwitchTime; /* in milliseconds */ }; #ifdef PAR -struct PAR_FLAGS { - rtsBool parallelStats; /* Gather parallel statistics */ - rtsBool granSimStats; /* Full .gr profile (rtsTrue) or only END events? */ - rtsBool granSimStats_Binary; - - rtsBool outputDisabled; /* Disable output for performance purposes */ - - unsigned int packBufferSize; - unsigned int maxLocalSparks; +/* currently the same as GRAN_STATS_FLAGS */ +struct PAR_STATS_FLAGS { + rtsBool Full; /* Full .gr profile (rtsTrue) or only END events? */ + // rtsBool Suppressed; /* No .gr profile at all */ + rtsBool Binary; /* Binary profile? (not yet implemented) */ + rtsBool Sparks; /* Info on sparks in profile? */ + rtsBool Heap; /* Info on heap allocs in profile? */ + rtsBool NewLogfile; /* Use new log-file format? (not yet implemented) */ + rtsBool Global; /* Global statistics? (printed on shutdown; no log file) */ }; +struct PAR_DEBUG_FLAGS { + /* flags to control debugging output in various subsystems */ + rtsBool verbose : 1; /* 1 */ + rtsBool trace : 1; /* 2 */ + rtsBool schedule : 1; /* 4 */ + rtsBool free : 1; /* 8 */ + rtsBool resume : 1; /* 16 */ + rtsBool weight : 1; /* 32 */ + rtsBool fetch : 1; /* 64 */ + rtsBool ack : 1; /* 128 */ + rtsBool fish : 1; /* 256 */ + rtsBool forward : 1; /* 512 */ + rtsBool pack : 1; /* 1024 */ +}; + +#define MAX_PAR_DEBUG_OPTION 10 +#define PAR_DEBUG_MASK(n) ((nat)(ldexp(1,n))) +#define MAX_PAR_DEBUG_MASK ((nat)(ldexp(1,(MAX_PAR_DEBUG_OPTION+1))-1)) + +struct PAR_FLAGS { + struct PAR_STATS_FLAGS ParStats; /* profile and stats output */ + struct PAR_DEBUG_FLAGS Debug; /* debugging options */ + rtsBool outputDisabled; /* Disable output for performance purposes */ + nat packBufferSize; + nat maxLocalSparks; /* spark pool size */ + nat maxThreads; /* thread pool size */ + nat maxFishes; /* max number of active fishes */ + rtsTime fishDelay; /* delay before sending a new fish */ + long wait; +}; #endif /* PAR */ +#ifdef SMP +struct PAR_FLAGS { + nat nNodes; /* number of threads to run simultaneously */ + unsigned int maxLocalSparks; +}; +#endif /* SMP */ + #ifdef GRAN +struct GRAN_STATS_FLAGS { + rtsBool Full; /* Full .gr profile (rtsTrue) or only END events? */ + rtsBool Suppressed; /* No .gr profile at all */ + rtsBool Binary; /* Binary profile? (not yet implemented) */ + rtsBool Sparks; /* Info on sparks in profile? */ + rtsBool Heap; /* Info on heap allocs in profile? */ + rtsBool NewLogfile; /* Use new log-file format? (not yet implemented) */ + rtsBool Global; /* Global statistics? (printed on shutdown; no log file) */ +}; + +struct GRAN_COST_FLAGS { + /* Communication Cost Variables -- set in main program */ + nat latency; /* Latency for single packet */ + nat additional_latency; /* Latency for additional packets */ + nat fetchtime; + nat lunblocktime; /* Time for local unblock */ + nat gunblocktime; /* Time for global unblock */ + nat mpacktime; /* Cost of creating a packet */ + nat munpacktime; /* Cost of receiving a packet */ + nat mtidytime; /* Cost of cleaning up after send */ + + nat threadcreatetime; /* Thread creation costs */ + nat threadqueuetime; /* Cost of adding a thread to the running/runnable queue */ + nat threaddescheduletime; /* Cost of descheduling a thread */ + nat threadscheduletime; /* Cost of scheduling a thread */ + nat threadcontextswitchtime; /* Cost of context switch */ + + /* Instruction Costs */ + nat arith_cost; /* arithmetic instructions (+,i,< etc) */ + nat branch_cost; /* branch instructions */ + nat load_cost; /* load into register */ + nat store_cost; /* store into memory */ + nat float_cost; /* floating point operations */ + + nat heapalloc_cost; /* heap allocation costs */ + + /* Overhead for granularity control mechanisms */ + /* overhead per elem of spark queue */ + nat pri_spark_overhead; + /* overhead per elem of thread queue */ + nat pri_sched_overhead; +}; + +struct GRAN_DEBUG_FLAGS { + /* flags to control debugging output in various subsystems */ + rtsBool event_trace : 1; /* 1 */ + rtsBool event_stats : 1; /* 2 */ + rtsBool bq : 1; /* 4 */ + rtsBool pack : 1; /* 8 */ + rtsBool checkSparkQ : 1; /* 16 */ + rtsBool thunkStealing : 1; /* 32 */ + rtsBool randomSteal : 1; /* 64 */ + rtsBool findWork : 1; /* 128 */ + rtsBool unused : 1; /* 256 */ + rtsBool pri : 1; /* 512 */ + rtsBool checkLight : 1; /* 1024 */ + rtsBool sortedQ : 1; /* 2048 */ + rtsBool blockOnFetch : 1; /* 4096 */ + rtsBool packBuffer : 1; /* 8192 */ + rtsBool blockOnFetch_sanity : 1; /* 16384 */ +}; + +#define MAX_GRAN_DEBUG_OPTION 14 +#define GRAN_DEBUG_MASK(n) ((nat)(ldexp(1,n))) +#define MAX_GRAN_DEBUG_MASK ((nat)(ldexp(1,(MAX_GRAN_DEBUG_OPTION+1))-1)) + struct GRAN_FLAGS { - rtsBool granSimStats; /* Full .gr profile (rtsTrue) or only END events? */ - rtsBool granSimStats_suppressed; /* No .gr profile at all */ - rtsBool granSimStats_Binary; - rtsBool granSimStats_Sparks; - rtsBool granSimStats_Heap; - rtsBool labelling; - unsigned int packBufferSize; - unsigned int packBufferSize_internal; - - int proc; /* number of processors */ - int max_fishes; /* max number of spark or thread steals */ - TIME time_slice; /* max time slice of one reduction thread */ - - /* Communication Cost Variables -- set in main program */ - unsigned int gran_latency; /* Latency for single packet */ - unsigned int gran_additional_latency; /* Latency for additional packets */ - unsigned int gran_fetchtime; - unsigned int gran_lunblocktime; /* Time for local unblock */ - unsigned int gran_gunblocktime; /* Time for global unblock */ - unsigned int gran_mpacktime; /* Cost of creating a packet */ - unsigned int gran_munpacktime; /* Cost of receiving a packet */ - unsigned int gran_mtidytime; /* Cost of cleaning up after send */ - - unsigned int gran_threadcreatetime; /* Thread creation costs */ - unsigned int gran_threadqueuetime; /* Cost of adding a thread to the running/runnable queue */ - unsigned int gran_threaddescheduletime; /* Cost of descheduling a thread */ - unsigned int gran_threadscheduletime; /* Cost of scheduling a thread */ - unsigned int gran_threadcontextswitchtime; /* Cost of context switch */ - - /* Instruction Costs */ - unsigned int gran_arith_cost; /* arithmetic instructions (+,i,< etc) */ - unsigned int gran_branch_cost; /* branch instructions */ - unsigned int gran_load_cost; /* load into register */ - unsigned int gran_store_cost; /* store into memory */ - unsigned int gran_float_cost; /* floating point operations */ - - unsigned int gran_heapalloc_cost; /* heap allocation costs */ - - /* Overhead for granularity control mechanisms */ - /* overhead per elem of spark queue */ - unsigned int gran_pri_spark_overhead; - /* overhead per elem of thread queue */ - unsigned int gran_pri_sched_overhead; + struct GRAN_STATS_FLAGS GranSimStats; /* profile and stats output */ + struct GRAN_COST_FLAGS Costs; /* cost metric for simulation */ + struct GRAN_DEBUG_FLAGS Debug; /* debugging options */ + + // rtsBool labelling; + nat packBufferSize; + nat packBufferSize_internal; + + PEs proc; /* number of processors */ + rtsBool Fishing; /* Simulate GUM style fishing mechanism? */ + nat maxFishes; /* max number of spark or thread steals */ + rtsTime time_slice; /* max time slice of one reduction thread */ /* GrAnSim-Light: This version puts no bound on the number of processors but in exchange doesn't model communication costs @@ -179,30 +259,27 @@ struct GRAN_FLAGS { rtsBool Light; rtsBool DoFairSchedule ; /* fair scheduling alg? default: unfair */ - rtsBool DoReScheduleOnFetch ; /* async. communication? */ + rtsBool DoAsyncFetch; /* async. communication? */ rtsBool DoStealThreadsFirst; /* prefer threads over sparks when stealing */ - rtsBool SimplifiedFetch; /* fast but inaccurate fetch modelling */ - rtsBool DoAlwaysCreateThreads; /* eager thread creation */ - rtsBool DoGUMMFetching; /* bulk fetching */ - rtsBool DoThreadMigration; /* allow to move threads */ - int FetchStrategy; /* what to do when waiting for data */ - rtsBool PreferSparksOfLocalNodes; /* prefer local over global sparks */ - rtsBool DoPrioritySparking; /* sparks sorted by priorities */ - rtsBool DoPriorityScheduling; /* threads sorted by priorities */ - int SparkPriority; /* threshold for cut-off mechanism */ - int SparkPriority2; - rtsBool RandomPriorities; - rtsBool InversePriorities; - rtsBool IgnorePriorities; - int ThunksToPack; /* number of thunks in packet + 1 */ - rtsBool RandomSteal; /* steal spark/thread from random proc */ - rtsBool NoForward; /* no forwarding of fetch messages */ - rtsBool PrintFetchMisses; /* print number of fetch misses */ - - unsigned int debug; - rtsBool event_trace; - rtsBool event_trace_all; - + rtsBool DoAlwaysCreateThreads; /* eager thread creation */ + rtsBool DoBulkFetching; /* bulk fetching */ + rtsBool DoThreadMigration; /* allow to move threads */ + nat FetchStrategy; /* what to do when waiting for data */ + rtsBool PreferSparksOfLocalNodes; /* prefer local over global sparks */ + rtsBool DoPrioritySparking; /* sparks sorted by priorities */ + rtsBool DoPriorityScheduling; /* threads sorted by priorities */ + nat SparkPriority; /* threshold for cut-off mechanism */ + nat SparkPriority2; + rtsBool RandomPriorities; + rtsBool InversePriorities; + rtsBool IgnorePriorities; + nat ThunksToPack; /* number of thunks in packet + 1 */ + rtsBool RandomSteal; /* steal spark/thread from random proc */ + rtsBool NoForward; /* no forwarding of fetch messages */ + + // unsigned int debug; + // rtsBool event_trace; + // rtsBool event_trace_all; }; #endif /* GRAN */ @@ -210,8 +287,6 @@ struct GRAN_FLAGS { struct TICKY_FLAGS { rtsBool showTickyStats; FILE *tickyFile; - - /* see also: doUpdEntryCounts in AllFlags */ }; #endif /* TICKY_TICKY */ @@ -220,7 +295,7 @@ struct TICKY_FLAGS { struct RTS_FLAGS { struct GC_FLAGS GcFlags; - struct DEBUG_FLAGS DebugFlags; /* unused at present */ + struct DEBUG_FLAGS DebugFlags; struct CONCURRENT_FLAGS ConcFlags; #if defined(PROFILING) || defined(PAR) @@ -229,7 +304,7 @@ struct RTS_FLAGS { #if defined(PROFILING) || defined(DEBUG) struct PROFILING_FLAGS ProfFlags; #endif -#ifdef PAR +#if defined(SMP) || defined(PAR) struct PAR_FLAGS ParFlags; #endif #ifdef GRAN @@ -240,7 +315,11 @@ struct RTS_FLAGS { #endif }; +#ifdef COMPILING_RTS_MAIN +extern DLLIMPORT struct RTS_FLAGS RtsFlags; +#else extern struct RTS_FLAGS RtsFlags; +#endif /* Routines that operate-on/to-do-with RTS flags: */ @@ -267,8 +346,11 @@ void setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]); #define TIME_FILENAME_FMT "%0.122s.time" #define TIME_FILENAME_FMT_GUM "%0.118s.%03d.time" -extern int prog_argc; /* an "int" so as to match normal "argc" */ +/* an "int" so as to match normal "argc" */ +/* Now defined in Stg.h (lib/std/cbits need these too.) +extern int prog_argc; extern char **prog_argv; +*/ extern int rts_argc; /* ditto */ extern char *rts_argv[];