aboutsummaryrefslogtreecommitdiffstats
path: root/mps/code
diff options
context:
space:
mode:
authorRichard Brooksby2012-08-31 04:38:42 +0100
committerRichard Brooksby2012-08-31 04:38:42 +0100
commit2208e93639e739b74992aa3d772f82b486e085c6 (patch)
treeb51f46baecd2546e62b0fa4a682f8c23c85c7b55 /mps/code
parent7d28876904ed310ef5b7ad7877fc8c5914ba67dc (diff)
downloademacs-2208e93639e739b74992aa3d772f82b486e085c6.tar.gz
emacs-2208e93639e739b74992aa3d772f82b486e085c6.zip
Eliminating old count and format columns from event definitions.
Copied from Perforce Change: 179123 ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
-rw-r--r--mps/code/dumper.c196
-rw-r--r--mps/code/eventcom.h6
-rw-r--r--mps/code/eventdef.h198
-rw-r--r--mps/code/eventpro.c6
4 files changed, 110 insertions, 296 deletions
diff --git a/mps/code/dumper.c b/mps/code/dumper.c
deleted file mode 100644
index 08edabe5726..00000000000
--- a/mps/code/dumper.c
+++ /dev/null
@@ -1,196 +0,0 @@
1/* dumper.c: Simple Event Dumper
2 *
3 * $Id$
4 * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
5 *
6 * .readership: MM developers.
7 *
8 * .purpose: This is a simple tool to dump events as text.
9 *
10 * .trans: As a tool, it's allowed to depend on the ANSI C library.
11 */
12
13#include <stdio.h>
14#include <stddef.h>
15#include <stdlib.h>
16#include <stdarg.h>
17#include <assert.h>
18#include "mpstd.h"
19
20typedef MPS_T_WORD Word;
21typedef struct AddrStruct *Addr;
22
23#include "eventcom.h"
24#include "eventdef.h"
25
26
27#ifdef MPS_PF_W3I6MV
28#define PRIuLONGEST "llu"
29#define PRIXPTR "016llX"
30typedef unsigned long long ulongest_t;
31#else
32#define PRIuLONGEST "lu"
33#define PRIXPTR "08lX"
34typedef unsigned long ulongest_t;
35#endif
36
37
38#define AVER(test) \
39 if(test) do {} while(0); else error("AVER: " #test)
40
41
42static char *prog;
43static FILE *progin;
44
45
46static void error (const char *format, ...) {
47 va_list args;
48 fprintf(stderr, "%s: Error: ", prog);
49 va_start(args, format);
50 vfprintf(stderr, format, args);
51 fputc('\n', stderr);
52 va_end(args);
53 exit(EXIT_FAILURE);
54 assert(0);
55}
56
57
58#define PROCESS(ch, type, _length, printfFormat, cast) \
59 case ch: { \
60 type v; \
61 size_t n = fread(&v, (_length), 1, progin); \
62 if(n < 1) \
63 error("Can't read data for format code >%c<", ch); \
64 printf(printfFormat " ", (cast)v); \
65 length -= (_length) / sizeof(Word); \
66 } break;
67
68
69static void readEvent(char *type, char *format, Word code, Word length,
70 Word cpuTime) {
71 AVER(type != NULL);
72 AVER(format != NULL);
73
74 printf("%-20s ", type);
75
76 for(; *format != '\0'; format++) {
77 switch(*format) {
78 PROCESS('A', Addr, sizeof(Addr), "0x%"PRIXPTR, ulongest_t)
79 PROCESS('P', void *, sizeof(void *), "0x%"PRIXPTR, ulongest_t)
80 PROCESS('U', unsigned, sizeof(unsigned),"%u", unsigned)
81 PROCESS('W', Word, sizeof(Word), "%"PRIuLONGEST, ulongest_t)
82 PROCESS('D', double, sizeof(double), "%f", double)
83 case 'S': {
84 size_t n;
85 char *v;
86 AVER(length > 0);
87 v = malloc(length * sizeof(Word));
88 if(v == NULL)
89 error("Can't allocate string space %u", (unsigned)length);
90 n = fread((void *)v, sizeof(Word), length, progin);
91 if(n < 1)
92 error("Can't read data for string");
93 printf("%s ", v);
94 length = 0;
95 } break;
96 case '0': break;
97 default:
98 error("Unknown format >%c<", *format);
99 break;
100 }
101 }
102 putc('\n', stdout);
103
104 AVER(length == 0);
105}
106
107
108int main(int argc, char *argv[]) {
109 Word header[3];
110 size_t arg = 1;
111
112 prog = (argc >= 1 ? argv[0] : "unknown");
113
114 /* parse options here [there aren't any] */
115
116 do {
117 if(argc <= 1) {
118 progin = stdin;
119 } else {
120 char *filename = argv[arg];
121 assert(filename != NULL);
122 progin = fopen(filename, "rb");
123 /* fopen returns NULL in error (ISO C 7.9.5.3) */
124 if(progin == NULL) {
125 error("Failed to open \"%s\".\n", filename);
126 }
127 ++arg;
128 }
129 while(!feof(progin)) {
130 size_t n;
131 n = fread(header, sizeof(Word), 3, progin);
132 if(n < 3) {
133 if(feof(progin))
134 continue;
135 error("Can't read from input");
136 }
137
138 switch(header[0]) {
139#define EVENT_CASE(X, type, code, always, kind, count, format) \
140 case Event ## type: \
141 readEvent(#type, #format, header[0], header[1], header[2]); \
142 break;
143 EVENT_LIST(EVENT_CASE, X)
144
145 default:
146 error("Unknown event code %"PRIXPTR, (ulongest_t)header[0]);
147 }
148 }
149 } while(arg < argc);
150
151 return(0);
152}
153
154
155
156
157/* C. COPYRIGHT AND LICENSE
158 *
159 * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
160 * All rights reserved. This is an open source license. Contact
161 * Ravenbrook for commercial licensing options.
162 *
163 * Redistribution and use in source and binary forms, with or without
164 * modification, are permitted provided that the following conditions are
165 * met:
166 *
167 * 1. Redistributions of source code must retain the above copyright
168 * notice, this list of conditions and the following disclaimer.
169 *
170 * 2. Redistributions in binary form must reproduce the above copyright
171 * notice, this list of conditions and the following disclaimer in the
172 * documentation and/or other materials provided with the distribution.
173 *
174 * 3. Redistributions in any form must be accompanied by information on how
175 * to obtain complete source code for this software and any accompanying
176 * software that uses this software. The source code must either be
177 * included in the distribution or be available for no more than the cost
178 * of distribution plus a nominal fee, and must be freely redistributable
179 * under reasonable conditions. For an executable file, complete source
180 * code means the source code for all modules it contains. It does not
181 * include source code for modules or files that typically accompany the
182 * major components of the operating system on which the executable file
183 * runs.
184 *
185 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
186 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
187 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
188 * PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
189 * COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
190 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
191 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
192 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
193 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
194 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
195 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
196 */
diff --git a/mps/code/eventcom.h b/mps/code/eventcom.h
index 6713b92ad33..fbd9d0df212 100644
--- a/mps/code/eventcom.h
+++ b/mps/code/eventcom.h
@@ -133,7 +133,7 @@ enum {
133 */ 133 */
134 134
135/* Note that enum values can be up to fifteen bits long portably. */ 135/* Note that enum values can be up to fifteen bits long portably. */
136#define EVENT_ENUM(X, name, code, always, kind, count, format) \ 136#define EVENT_ENUM(X, name, code, always, kind) \
137 enum { \ 137 enum { \
138 Event##name##Code = code, \ 138 Event##name##Code = code, \
139 Event##name##Always = always, \ 139 Event##name##Always = always, \
@@ -168,7 +168,7 @@ typedef struct EventAnyStruct {
168#define EVENT_STRUCT_FIELD(X, index, sort, ident) \ 168#define EVENT_STRUCT_FIELD(X, index, sort, ident) \
169 EventF##sort f##index; 169 EventF##sort f##index;
170 170
171#define EVENT_STRUCT(X, name, _code, always, kind, count, format) \ 171#define EVENT_STRUCT(X, name, _code, always, kind) \
172 typedef struct Event##name##Struct { \ 172 typedef struct Event##name##Struct { \
173 EventCode code; \ 173 EventCode code; \
174 EventSize size; \ 174 EventSize size; \
@@ -186,7 +186,7 @@ EVENT_LIST(EVENT_STRUCT, X)
186 * by examining event->any.code. 186 * by examining event->any.code.
187 */ 187 */
188 188
189#define EVENT_UNION_MEMBER(X, name, code, always, kind, count, format) \ 189#define EVENT_UNION_MEMBER(X, name, code, always, kind) \
190 Event##name##Struct name; 190 Event##name##Struct name;
191 191
192typedef union EventUnion { 192typedef union EventUnion {
diff --git a/mps/code/eventdef.h b/mps/code/eventdef.h
index 90207d0ac62..fee64b8fce1 100644
--- a/mps/code/eventdef.h
+++ b/mps/code/eventdef.h
@@ -37,7 +37,7 @@
37#define EVENT_VERSION_MINOR ((unsigned)0) 37#define EVENT_VERSION_MINOR ((unsigned)0)
38 38
39 39
40/* Relations -- Generic definitions of events 40/* EVENT_LIST -- list of event types and general properties
41 * 41 *
42 * These specify: 42 * These specify:
43 * - Type: The name of the event type, without the leading "Event"; 43 * - Type: The name of the event type, without the leading "Event";
@@ -46,117 +46,125 @@
46 * varieties, not currently used; 46 * varieties, not currently used;
47 * - Kind: Category into which this event falls, without the 47 * - Kind: Category into which this event falls, without the
48 * leading "EventKind"; 48 * leading "EventKind";
49 * - Parameter Count 49 *
50 * - Format: Tuple indicating the format of the event 50 * See also EVENT_*_PARAMS for definition of event parameters.
51 * parameters, similar to writef (Pointer, Addr, Word, Unsigned,
52 * String, Double).
53 */ 51 */
54 52
55/* FIXME: Work out why not-in-use events were not in use and restore or delete them. */ 53/* FIXME: Work out why not-in-use events were not in use and restore or delete them. */
56 54
57#define EVENT_LIST(EVENT, X) \ 55#define EVENT_LIST(EVENT, X) \
58 /* 0123456789012345678 <- don't exceed without changing EventNameMAX */ \ 56 /* 0123456789012345678 <- don't exceed without changing EventNameMAX */ \
59 EVENT(X, AMCGenCreate , 0x0001, TRUE, Pool, 2, (P,P)) \ 57 EVENT(X, AMCGenCreate , 0x0001, TRUE, Pool) \
60 EVENT(X, AMCGenDestroy , 0x0002, TRUE, Pool, 1, (P)) \ 58 EVENT(X, AMCGenDestroy , 0x0002, TRUE, Pool) \
61 EVENT(X, AMCInit , 0x0003, TRUE, Pool, 2, (P,P)) \ 59 EVENT(X, AMCInit , 0x0003, TRUE, Pool) \
62 EVENT(X, AMCFinish , 0x0004, TRUE, Pool, 1, (P)) \ 60 EVENT(X, AMCFinish , 0x0004, TRUE, Pool) \
63 EVENT(X, ArenaCreateVM , 0x0005, TRUE, Arena, 3, (P,W,W)) \ 61 EVENT(X, ArenaCreateVM , 0x0005, TRUE, Arena) \
64 EVENT(X, ArenaCreateVMNZ , 0x0006, TRUE, Arena, 3, (P,W,W)) \ 62 EVENT(X, ArenaCreateVMNZ , 0x0006, TRUE, Arena) \
65 EVENT(X, ArenaWriteFaults , 0x0007, TRUE, Trace, 2, (P,W)) \ 63 EVENT(X, ArenaWriteFaults , 0x0007, TRUE, Trace) \
66 EVENT(X, MeterInit , 0x0008, TRUE, Pool, 2, (P,P)) \ 64 EVENT(X, MeterInit , 0x0008, TRUE, Pool) \
67 EVENT(X, MeterValues , 0x0009, TRUE, Pool, 6, (P,D,D,W,W,W)) \ 65 EVENT(X, MeterValues , 0x0009, TRUE, Pool) \
68 EVENT(X, AMCScanBegin , 0x000a, TRUE, Seg, 3, (P,P,P)) \ 66 EVENT(X, AMCScanBegin , 0x000a, TRUE, Seg) \
69 EVENT(X, AMCScanEnd , 0x000b, TRUE, Seg, 3, (P,P,P)) \ 67 EVENT(X, AMCScanEnd , 0x000b, TRUE, Seg) \
70 EVENT(X, AMCFix , 0x000c, FALSE, Ref, 0, ()) \ 68 EVENT(X, AMCFix , 0x000c, FALSE, Ref) \
71 EVENT(X, AMCFixInPlace , 0x000d, FALSE, Ref, 0, ()) \ 69 EVENT(X, AMCFixInPlace , 0x000d, FALSE, Ref) \
72 EVENT(X, AMCFixForward , 0x000e, FALSE, Ref, 1, (A)) \ 70 EVENT(X, AMCFixForward , 0x000e, FALSE, Ref) \
73 EVENT(X, AMCReclaim , 0x000f, TRUE, Seg, 3, (P,P,P)) \ 71 EVENT(X, AMCReclaim , 0x000f, TRUE, Seg) \
74 /* EVENT(X, AMCTraceEnd , 0x0010, TRUE, Trace, 3, (P,P,P)) */ \ 72 /* EVENT(X, AMCTraceEnd , 0x0010, TRUE, Trace) */ \
75 EVENT(X, ArenaCreateCL , 0x0011, TRUE, Arena, 3, (P,W,A)) \ 73 EVENT(X, ArenaCreateCL , 0x0011, TRUE, Arena) \
76 EVENT(X, ArenaDestroy , 0x0012, TRUE, Arena, 1, (P)) \ 74 EVENT(X, ArenaDestroy , 0x0012, TRUE, Arena) \
77 EVENT(X, SegAlloc , 0x0013, TRUE, Seg, 5, (P,P,A,W,P)) \ 75 EVENT(X, SegAlloc , 0x0013, TRUE, Seg) \
78 EVENT(X, SegFree , 0x0014, TRUE, Seg, 2, (P,P)) \ 76 EVENT(X, SegFree , 0x0014, TRUE, Seg) \
79 EVENT(X, PoolInit , 0x0015, TRUE, Pool, 3, (P,P,P)) \ 77 EVENT(X, PoolInit , 0x0015, TRUE, Pool) \
80 EVENT(X, PoolFinish , 0x0016, TRUE, Pool, 1, (P)) \ 78 EVENT(X, PoolFinish , 0x0016, TRUE, Pool) \
81 EVENT(X, PoolAlloc , 0x0017, TRUE, Object, 3, (P,A,W)) \ 79 EVENT(X, PoolAlloc , 0x0017, TRUE, Object) \
82 EVENT(X, PoolFree , 0x0018, TRUE, Object, 3, (P,A,W)) \ 80 EVENT(X, PoolFree , 0x0018, TRUE, Object) \
83 EVENT(X, CBSInit , 0x0019, TRUE, Pool, 2, (P,P)) \ 81 EVENT(X, CBSInit , 0x0019, TRUE, Pool) \
84 EVENT(X, Intern , 0x001a, TRUE, User, 2, (W,S)) \ 82 EVENT(X, Intern , 0x001a, TRUE, User) \
85 EVENT(X, Label , 0x001b, TRUE, User, 2, (A,W)) \ 83 EVENT(X, Label , 0x001b, TRUE, User) \
86 /* EVENT(X, TraceStart , 0x001c, TRUE, Trace, 3, (P,P,P)) */ \ 84 /* EVENT(X, TraceStart , 0x001c, TRUE, Trace) */ \
87 /* EVENT(X, TraceCreate , 0x001d, TRUE, Trace, 4, (P,P,P,U)) */ \ 85 /* EVENT(X, TraceCreate , 0x001d, TRUE, Trace) */ \
88 EVENT(X, TraceDestroy , 0x001e, TRUE, Trace, 1, (P)) \ 86 EVENT(X, TraceDestroy , 0x001e, TRUE, Trace) \
89 EVENT(X, SegSetGrey , 0x001f, TRUE, Seg, 3, (P,P,U)) \ 87 EVENT(X, SegSetGrey , 0x001f, TRUE, Seg) \
90 EVENT(X, TraceFlipBegin , 0x0020, TRUE, Trace, 2, (P,P)) \ 88 EVENT(X, TraceFlipBegin , 0x0020, TRUE, Trace) \
91 EVENT(X, TraceFlipEnd , 0x0021, TRUE, Trace, 2, (P,P)) \ 89 EVENT(X, TraceFlipEnd , 0x0021, TRUE, Trace) \
92 EVENT(X, TraceReclaim , 0x0022, TRUE, Seg, 1, (P)) \ 90 EVENT(X, TraceReclaim , 0x0022, TRUE, Seg) \
93 /* EVENT(X, TraceScan , 0x0023, TRUE, Seg, 5, (U,U,P,P,P)) */ \ 91 /* EVENT(X, TraceScan , 0x0023, TRUE, Seg) */ \
94 EVENT(X, TraceAccess , 0x0024, TRUE, Seg, 3, (P,P,U)) \ 92 EVENT(X, TraceAccess , 0x0024, TRUE, Seg) \
95 /* TracePoll's kind isn't really Trace, but then it isn't Seg either */ \ 93 /* TracePoll's kind isn't really Trace, but then it isn't Seg either */ \
96 /* EVENT(X, TracePoll , 0x0025, TRUE, Trace, 2, (P,P)) */ \ 94 /* EVENT(X, TracePoll , 0x0025, TRUE, Trace) */ \
97 EVENT(X, TraceFix , 0x0026, FALSE, Ref, 4, (P,P,A,U)) \ 95 EVENT(X, TraceFix , 0x0026, FALSE, Ref) \
98 EVENT(X, TraceFixSeg , 0x0027, FALSE, Ref, 1, (P)) \ 96 EVENT(X, TraceFixSeg , 0x0027, FALSE, Ref) \
99 EVENT(X, TraceFixWhite , 0x0028, FALSE, Ref, 0, ()) \ 97 EVENT(X, TraceFixWhite , 0x0028, FALSE, Ref) \
100 /* TraceScanArea{Tagged} abuses kind, see .kind.abuse */ \ 98 /* TraceScanArea{Tagged} abuses kind, see .kind.abuse */ \
101 EVENT(X, TraceScanArea , 0x0029, TRUE, Seg, 3, (P,P,P)) \ 99 EVENT(X, TraceScanArea , 0x0029, TRUE, Seg) \
102 EVENT(X, TraceScanAreaTagged, 0x002a, TRUE, Seg, 3, (P,P,P)) \ 100 EVENT(X, TraceScanAreaTagged, 0x002a, TRUE, Seg) \
103 EVENT(X, VMCreate , 0x002b, TRUE, Arena, 3, (P,A,A)) \ 101 EVENT(X, VMCreate , 0x002b, TRUE, Arena) \
104 EVENT(X, VMDestroy , 0x002c, TRUE, Arena, 1, (P)) \ 102 EVENT(X, VMDestroy , 0x002c, TRUE, Arena) \
105 EVENT(X, VMMap , 0x002d, TRUE, Seg, 3, (P,A,A)) \ 103 EVENT(X, VMMap , 0x002d, TRUE, Seg) \
106 EVENT(X, VMUnmap , 0x002e, TRUE, Seg, 3, (P,A,A)) \ 104 EVENT(X, VMUnmap , 0x002e, TRUE, Seg) \
107 EVENT(X, ArenaExtend , 0x002f, TRUE, Arena, 3, (P,A,W)) \ 105 EVENT(X, ArenaExtend , 0x002f, TRUE, Arena) \
108 /* EVENT(X, ArenaRetract , 0x0030, TRUE, Arena, 3, (P,A,W)) */ \ 106 /* EVENT(X, ArenaRetract , 0x0030, TRUE, Arena) */ \
109 /* EVENT(X, TraceSegGreyen , 0x0031, TRUE, Seg, 3, (P,P,U)) */ \ 107 /* EVENT(X, TraceSegGreyen , 0x0031, TRUE, Seg) */ \
110 /* RootScanned abuses kind, see .kind.abuse */ \ 108 /* RootScanned abuses kind, see .kind.abuse */ \
111 EVENT(X, RootScan , 0x0032, TRUE, Seg, 3, (P,W,W)) \ 109 EVENT(X, RootScan , 0x0032, TRUE, Seg) \
112 /* TraceStep abuses kind, see .kind.abuse */ \ 110 /* TraceStep abuses kind, see .kind.abuse */ \
113 /* EVENT(X, TraceStep , 0x0033, TRUE, Seg, 2, (P,P)) */ \ 111 /* EVENT(X, TraceStep , 0x0033, TRUE, Seg) */ \
114 EVENT(X, BufferReserve , 0x0034, TRUE, Object, 3, (P,A,W)) \ 112 EVENT(X, BufferReserve , 0x0034, TRUE, Object) \
115 EVENT(X, BufferCommit , 0x0035, TRUE, Object, 4, (P,A,W,A)) \ 113 EVENT(X, BufferCommit , 0x0035, TRUE, Object) \
116 /* BufferInit/Finish abuse kind, see .kind.abuse */ \ 114 /* BufferInit/Finish abuse kind, see .kind.abuse */ \
117 EVENT(X, BufferInit , 0x0036, TRUE, Pool, 3, (P,P,U)) \ 115 EVENT(X, BufferInit , 0x0036, TRUE, Pool) \
118 EVENT(X, BufferFinish , 0x0037, TRUE, Pool, 1, (P)) \ 116 EVENT(X, BufferFinish , 0x0037, TRUE, Pool) \
119 /* EVENT(X, MVTFinish , 0x0038, TRUE, Pool, 1, (P)) */ \ 117 /* EVENT(X, MVTFinish , 0x0038, TRUE, Pool) */ \
120 EVENT(X, BufferFill , 0x0039, TRUE, Seg, 4, (P,W,A,W)) \ 118 EVENT(X, BufferFill , 0x0039, TRUE, Seg) \
121 EVENT(X, BufferEmpty , 0x003A, TRUE, Seg, 2, (P,W)) \ 119 EVENT(X, BufferEmpty , 0x003A, TRUE, Seg) \
122 EVENT(X, SegAllocFail , 0x003B, TRUE, Seg, 3, (P,W,P)) \ 120 EVENT(X, SegAllocFail , 0x003B, TRUE, Seg) \
123 EVENT(X, TraceScanSeg , 0x003C, TRUE, Seg, 4, (U,U,P,P)) \ 121 EVENT(X, TraceScanSeg , 0x003C, TRUE, Seg) \
124 /* TraceScanSingleRef abuses kind, see .kind.abuse */ \ 122 /* TraceScanSingleRef abuses kind, see .kind.abuse */ \
125 EVENT(X, TraceScanSingleRef , 0x003D, TRUE, Seg, 4, (U,U,P,A)) \ 123 EVENT(X, TraceScanSingleRef , 0x003D, TRUE, Seg) \
126 EVENT(X, TraceStatCondemn , 0x003E, TRUE, Trace, 7, (P,W,W,W,W,D,D)) \ 124 EVENT(X, TraceStatCondemn , 0x003E, TRUE, Trace) \
127 EVENT(X, TraceStatScan , 0x003F, TRUE, Trace, 13, (P,W,W,W,W,W,W,W,W,W,W,W,W)) \ 125 EVENT(X, TraceStatScan , 0x003F, TRUE, Trace) \
128 EVENT(X, TraceStatFix , 0x0040, TRUE, Trace, 10, (P,W,W,W,W,W,W,W,W,W)) \ 126 EVENT(X, TraceStatFix , 0x0040, TRUE, Trace) \
129 EVENT(X, TraceStatReclaim , 0x0041, TRUE, Trace, 3, (P,W,W)) \ 127 EVENT(X, TraceStatReclaim , 0x0041, TRUE, Trace) \
130 EVENT(X, PoolInitMVFF , 0x0042, TRUE, Pool, 8, (P,P,W,W,W,U,U,U)) \ 128 EVENT(X, PoolInitMVFF , 0x0042, TRUE, Pool) \
131 EVENT(X, PoolInitMV , 0x0043, TRUE, Pool, 5, (P,P,W,W,W)) \ 129 EVENT(X, PoolInitMV , 0x0043, TRUE, Pool) \
132 EVENT(X, PoolInitMFS , 0x0044, TRUE, Pool, 4, (P,P,W,W)) \ 130 EVENT(X, PoolInitMFS , 0x0044, TRUE, Pool) \
133 /* EVENT(X, PoolInitEPVM , 0x0045, TRUE, Pool, 5, (P,P,P,U,U)) */ \ 131 /* EVENT(X, PoolInitEPVM , 0x0045, TRUE, Pool) */ \
134 /* EVENT(X, PoolInitEPDL , 0x0046, TRUE, Pool, 6, (P,P,U,W,W,W)) */ \ 132 /* EVENT(X, PoolInitEPDL , 0x0046, TRUE, Pool) */ \
135 EVENT(X, PoolInitAMS , 0x0047, TRUE, Pool, 3, (P,P,P)) \ 133 EVENT(X, PoolInitAMS , 0x0047, TRUE, Pool) \
136 EVENT(X, PoolInitAMC , 0x0048, TRUE, Pool, 2, (P,P)) \ 134 EVENT(X, PoolInitAMC , 0x0048, TRUE, Pool) \
137 EVENT(X, PoolInitAMCZ , 0x0049, TRUE, Pool, 2, (P,P)) \ 135 EVENT(X, PoolInitAMCZ , 0x0049, TRUE, Pool) \
138 EVENT(X, PoolInitAWL , 0x004A, TRUE, Pool, 2, (P,P)) \ 136 EVENT(X, PoolInitAWL , 0x004A, TRUE, Pool) \
139 EVENT(X, PoolInitLO , 0x004B, TRUE, Pool, 2, (P,P)) \ 137 EVENT(X, PoolInitLO , 0x004B, TRUE, Pool) \
140 EVENT(X, PoolInitSNC , 0x004C, TRUE, Pool, 2, (P,P)) \ 138 EVENT(X, PoolInitSNC , 0x004C, TRUE, Pool) \
141 EVENT(X, PoolInitMVT , 0x004D, TRUE, Pool, 6, (P,W,W,W,W,W)) \ 139 EVENT(X, PoolInitMVT , 0x004D, TRUE, Pool) \
142 /* EVENT(X, BufferInitEPVM , 0x0050, TRUE, Pool, 3, (P,P,U)) */ \ 140 /* EVENT(X, BufferInitEPVM , 0x0050, TRUE, Pool) */ \
143 EVENT(X, BufferInitSeg , 0x0051, TRUE, Pool, 3, (P,P,U)) \ 141 EVENT(X, BufferInitSeg , 0x0051, TRUE, Pool) \
144 EVENT(X, BufferInitRank , 0x0052, TRUE, Pool, 4, (P,P,U,U)) \ 142 EVENT(X, BufferInitRank , 0x0052, TRUE, Pool) \
145 /* PoolPush/Pop go under Object, because they're user ops. */ \ 143 /* PoolPush/Pop go under Object, because they're user ops. */ \
146 /* EVENT(X, PoolPush , 0x0060, TRUE, Object, 1, (P)) */ \ 144 /* EVENT(X, PoolPush , 0x0060, TRUE, Object) */ \
147 /* EVENT(X, PoolPop , 0x0061, TRUE, Object, 2, (P,U)) */ \ 145 /* EVENT(X, PoolPop , 0x0061, TRUE, Object) */ \
148 EVENT(X, ReservoirLimitSet , 0x0062, TRUE, Arena, 2, (P,W)) \ 146 EVENT(X, ReservoirLimitSet , 0x0062, TRUE, Arena) \
149 EVENT(X, CommitLimitSet , 0x0063, TRUE, Arena, 3, (P,W,U)) \ 147 EVENT(X, CommitLimitSet , 0x0063, TRUE, Arena) \
150 EVENT(X, SpareCommitLimitSet, 0x0064, TRUE, Arena, 2, (P,W)) \ 148 EVENT(X, SpareCommitLimitSet, 0x0064, TRUE, Arena) \
151 EVENT(X, ArenaAlloc , 0x0065, TRUE, Arena, 5, (P,P,A,W,P)) \ 149 EVENT(X, ArenaAlloc , 0x0065, TRUE, Arena) \
152 EVENT(X, ArenaFree , 0x0066, TRUE, Arena, 3, (P,A,W)) \ 150 EVENT(X, ArenaFree , 0x0066, TRUE, Arena) \
153 EVENT(X, ArenaAllocFail , 0x0067, TRUE, Arena, 3, (P,W,P)) \ 151 EVENT(X, ArenaAllocFail , 0x0067, TRUE, Arena) \
154 EVENT(X, SegMerge , 0x0068, TRUE, Seg, 3, (P,P,U)) \ 152 EVENT(X, SegMerge , 0x0068, TRUE, Seg) \
155 EVENT(X, SegSplit , 0x0069, TRUE, Seg, 4, (P,P,P,A)) 153 EVENT(X, SegSplit , 0x0069, TRUE, Seg)
156 154
157/* Remember to update EventNameMAX and EventCodeMAX in eventcom.h! */ 155/* Remember to update EventNameMAX and EventCodeMAX in eventcom.h! */
158 156
159 157
158/* EVENT_*_PARAMS -- definition of event parameters
159 *
160 * For each event type in EVENT_LIST, these macros list the parameters of
161 * the event. THe columns are:
162 * - the positional index of the parameter in the list
163 * - the parameter sort, similar to writef (Pointer, Addr, Word, Unsigned,
164 * String, Double)
165 * - a parameter name for display
166 */
167
160#define EVENT_AMCGenCreate_PARAMS(PARAM, X) \ 168#define EVENT_AMCGenCreate_PARAMS(PARAM, X) \
161 PARAM(X, 0, P, amc) \ 169 PARAM(X, 0, P, amc) \
162 PARAM(X, 1, P, gen) 170 PARAM(X, 1, P, gen)
diff --git a/mps/code/eventpro.c b/mps/code/eventpro.c
index 0abc8e8735f..768d21adac6 100644
--- a/mps/code/eventpro.c
+++ b/mps/code/eventpro.c
@@ -78,16 +78,18 @@ typedef struct {
78 EventSize offsets[15]; /* FIXME: literal constant */ 78 EventSize offsets[15]; /* FIXME: literal constant */
79} eventRecord; 79} eventRecord;
80 80
81#define EVENT_COUNT_PARAM(X, index, sort, ident) + 1
82
81#define EVENT_FORMAT_PARAM(X, index, sort, ident) #sort 83#define EVENT_FORMAT_PARAM(X, index, sort, ident) #sort
82 84
83#define EVENT_OFFSETS_PARAM(name, index, sort, ident) \ 85#define EVENT_OFFSETS_PARAM(name, index, sort, ident) \
84 offsetof(Event##name##Struct, f##index), 86 offsetof(Event##name##Struct, f##index),
85 87
86#define EVENT_INIT(X, name, code, always, kind, count, format) \ 88#define EVENT_INIT(X, name, code, always, kind) \
87 {#name, \ 89 {#name, \
88 code, \ 90 code, \
89 EventSizeAlign(sizeof(Event##name##Struct)), \ 91 EventSizeAlign(sizeof(Event##name##Struct)), \
90 count, \ 92 0 EVENT_##name##_PARAMS(EVENT_COUNT_PARAM, X), \
91 "" EVENT_##name##_PARAMS(EVENT_FORMAT_PARAM, X), \ 93 "" EVENT_##name##_PARAMS(EVENT_FORMAT_PARAM, X), \
92 { EVENT_##name##_PARAMS(EVENT_OFFSETS_PARAM, name) 0 }}, 94 { EVENT_##name##_PARAMS(EVENT_OFFSETS_PARAM, name) 0 }},
93 95