From e64cb01f875a3be9962e31662a187a582d412e8d Mon Sep 17 00:00:00 2001 From: Richard Brooksby Date: Wed, 5 Sep 2012 19:02:44 +0100 Subject: Responding to dl's review comments. mostly clarifications. Copied from Perforce Change: 179280 ServerID: perforce.ravenbrook.com --- mps/code/eventcnv.c | 2 +- mps/code/eventcom.h | 14 +++++++------- mps/code/eventdef.h | 6 ++++-- mps/code/eventpro.c | 4 ---- 4 files changed, 12 insertions(+), 14 deletions(-) (limited to 'mps/code') diff --git a/mps/code/eventcnv.c b/mps/code/eventcnv.c index 38752a7b9d4..8e1ba9aecb2 100644 --- a/mps/code/eventcnv.c +++ b/mps/code/eventcnv.c @@ -95,7 +95,7 @@ static void usage(void) { fprintf(stderr, "Usage: %s [-f logfile] [-p] [-v] [-e events] [-b size]" - " [-S[LC]] [-?]\nSee guide.mps.telemetry for instructions.", + " [-S[LC]] [-?]\nSee guide.mps.telemetry for instructions.\n", prog); } diff --git a/mps/code/eventcom.h b/mps/code/eventcom.h index d92d22d610f..c0eca4b7b15 100644 --- a/mps/code/eventcom.h +++ b/mps/code/eventcom.h @@ -50,7 +50,7 @@ typedef unsigned __int64 EventClock; #if defined(MPS_ARCH_I3) #define EVENT_CLOCK_WRITE(stream, clock) \ WriteF(stream, "$W$W", (WriteFW)((clock) >> 32), (WriteFW)clock, NULL) -#else /* I6 */ +#elif defined(MPS_ARCH_I6) #define EVENT_CLOCK_WRITE(stream, clock) \ WriteF(stream, "$W", (WriteFW)(clock), NULL) #endif @@ -153,10 +153,12 @@ typedef unsigned short EventSize; /* Common prefix for all event structures. The size field allows an event reader to skip over events whose codes it does not recognise. */ -typedef struct EventAnyStruct { - EventCode code; /* encoding of the event type */ - EventSize size; /* allows reader to skip events of unknown code */ +#define EVENT_ANY_FIELDS \ + EventCode code; /* encoding of the event type */ \ + EventSize size; /* allows reader to skip events of unknown code */ \ EventClock clock; /* when the event occurred */ +typedef struct EventAnyStruct { + EVENT_ANY_FIELDS } EventAnyStruct; /* Event field types, for indexing by macro on the event parameter sort */ @@ -182,9 +184,7 @@ typedef int EventFB; /* boolean */ #define EVENT_STRUCT(X, name, _code, always, kind) \ typedef struct Event##name##Struct { \ - EventCode code; /* Must match EventAnyStruct */ \ - EventSize size; /* ditto */ \ - EventClock clock; /* ditto */ \ + EVENT_ANY_FIELDS \ EVENT_##name##_PARAMS(EVENT_STRUCT_FIELD, X) \ } Event##name##Struct; diff --git a/mps/code/eventdef.h b/mps/code/eventdef.h index 346b61df5ad..83c7a3850f8 100644 --- a/mps/code/eventdef.h +++ b/mps/code/eventdef.h @@ -42,8 +42,7 @@ * These specify: * - Type: The name of the event type, without the leading "Event"; * - Code: The unique 16-bit code associated with this event type; - * - Always: Whether this event type should appear in optimised - * varieties, not currently used; + * - Always: Whether this event type should appear in "hot" varieties, * - Kind: Category into which this event falls, without the * leading "EventKind"; * @@ -52,6 +51,9 @@ * in older logs, and prevents the codes being re-used. See * . * + * When you add an event type, you must also add an EVENT_*_PARAMS macro + * specify its parameters below. + * * TODO: Add a doc string to each event type. * * See also EVENT_*_PARAMS for definition of event parameters. diff --git a/mps/code/eventpro.c b/mps/code/eventpro.c index 439746bf950..842ee11b80d 100644 --- a/mps/code/eventpro.c +++ b/mps/code/eventpro.c @@ -5,11 +5,7 @@ */ #include "config.h" -/* override variety setting for EVENT */ -#define EVENT - #include "table.h" - #include "eventdef.h" #include "eventcom.h" #include "eventpro.h" -- cgit v1.2.1