[project @ 1996-07-25 20:43:49 by partain]
[ghc-hetmet.git] / ghc / includes / RtsTypes.lh
1 %
2 % (c) The GRASP/AQUA Project, Glasgow University, 1995
3 %
4 %************************************************************************
5 %*                                                                      *
6 \section{How data is handled within the RTS}
7 %*                                                                      *
8 %************************************************************************
9
10 \begin{code}
11 #ifndef RTSTYPES_H
12 #define RTSTYPES_H
13 \end{code}
14
15 For all of you boolean crazies out there...
16
17 \begin{code}
18
19 typedef enum { 
20     rtsFalse = 0, 
21     rtsTrue 
22 } rtsBool;
23
24 \end{code}
25
26 Hash tables for GUM are ADTs.  Peek inside, and I'll have to kill you.
27 The same goes for hash list cells.
28
29 \begin{code}
30 #ifdef PAR
31 typedef struct hashtable HashTable;
32 typedef struct hashlist HashList;
33
34 typedef double REAL_TIME;
35 typedef int GLOBAL_TASK_ID;
36 typedef int PACKET;
37 typedef int OPCODE;
38
39 /* Global addresses, in all their glory */
40
41 typedef struct {
42     union {
43         P_ plc;
44         struct {
45             GLOBAL_TASK_ID gtid;
46             int slot;
47         } gc;
48     } loc;
49     unsigned weight;
50 } globalAddr;
51
52 /* (GA, LA) pairs */
53 typedef struct gala {
54     globalAddr ga;
55     P_ la;
56     struct gala *next;
57     rtsBool preferred;
58 } GALA;
59
60 #endif
61
62 #if defined(GRAN)
63 typedef unsigned long TIME;
64 typedef unsigned char PROC;
65 typedef unsigned char EVTTYPE;
66 #endif
67
68 #if defined(PAR)
69 typedef W_ TIME;
70 typedef GLOBAL_TASK_ID PROC;
71 #endif
72
73 \end{code}
74
75 A cost centre is represented by a pointer to a static structure
76 containing the @label@, @module@, @group@, and the statistical meters
77 we are collecting.
78
79 \begin{code}
80 #if defined(PROFILING) || defined(CONCURRENT)
81
82 typedef struct cc {
83     struct cc *registered;      /* list of registered cost centres      */
84     hash_t index_val;           /* hashed index -- initially UNHASHED   */
85         
86     char *label;                /* cost centre label                    */
87     char *module;               /* name of module in which _scc_ occurs */
88     char *group;                /* name of group  in which _scc_ occurs */
89
90     char is_subsumed;           /* 'B'  => *not* a CAF/dict/sub cc      */
91                                 /* 's'  => *is* a subsumed cc           */
92                                 /* 'c'  => *is* a CAF cc                */
93                                 /* 'd'  => *is* a dictionary cc         */
94                                 /* IS_CAF_OR_DICT_OR_SUB_CC tests for lowercase bit */
95
96     /* Statistics Gathered */
97
98     W_ scc_count;               /* no of scc expression instantiations  */
99     W_ sub_scc_count;           /* no of scc's set inside this cc       */
100     W_ sub_cafcc_count;         /* no of scc's set inside this cc       */
101     W_ sub_dictcc_count;        /* no of scc's set inside this cc       */
102
103 #if defined(PROFILING_DETAIL_COUNTS)
104     W_ thunk_count;             /* no of {thunk,function,PAP} enters    */
105     W_ function_count;          /*    in this cost centre               */
106     W_ pap_count;
107     W_ mem_allocs;              /* no of allocations                    */
108
109     W_ subsumed_fun_count;      /* no of functions subsumed             */
110     W_ subsumed_caf_count;      /* no of caf/dict funs subsumed         */
111     W_ caffun_subsumed;         /* no of subsumes from this caf/dict    */
112 #endif
113
114     W_ time_ticks;              /* no of timer interrupts -- current interval */
115     W_ prev_ticks;              /* no of timer interrupts -- previous intervals */
116     W_ mem_alloc;               /* no of words allocated (excl CC_HDR)  */
117
118     /* Heap Profiling by Cost Centre */
119
120     W_ selected;                /* is this cost centre selected */
121
122 } *CostCentre;
123
124 #if defined(PROFILING_DETAIL_COUNTS)
125 #define INIT_CC_STATS   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
126 #else
127 #define INIT_CC_STATS   0,0,0,0,0,0,0,0
128 #endif
129
130 #endif /* defined(PROFILING) || defined(CONCURRENT) */
131 \end{code}
132
133 This structure will need to be expanded change as the statistics we
134 gather improve.
135
136 \begin{code}
137 #endif /* ! RTSTYPES_H */
138 \end{code}
139