X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2Feventlog%2FEventLog.c;h=65eff8a0123ea51505d608c45734d1b730c55cbd;hb=5407ad8e0a5c08ac5193c1a9ede2a12570baee0b;hp=a972f4da5462290cae5e1f87f80c575104ffde37;hpb=e459b0d1199bff41cb92678493e4f462cea8aaf6;p=ghc-hetmet.git diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c index a972f4d..65eff8a 100644 --- a/rts/eventlog/EventLog.c +++ b/rts/eventlog/EventLog.c @@ -62,6 +62,7 @@ char *EventDesc[] = { [EVENT_REQUEST_PAR_GC] = "Request parallel GC", [EVENT_CREATE_SPARK_THREAD] = "Create spark thread", [EVENT_LOG_MSG] = "Log message", + [EVENT_USER_MSG] = "User message", [EVENT_STARTUP] = "Startup", [EVENT_BLOCK_MARKER] = "Block marker" }; @@ -82,7 +83,7 @@ static void printAndClearEventBuf (EventsBuf *eventsBuf); static void postEventType(EventsBuf *eb, EventType *et); -static void postLogMsg(EventsBuf *eb, char *msg, va_list ap); +static void postLogMsg(EventsBuf *eb, EventTypeNum type, char *msg, va_list ap); static void postBlockMarker(EventsBuf *eb); static void closeBlockMarker(EventsBuf *ebuf); @@ -173,7 +174,7 @@ initEventLogging(void) /* Open event log file for writing. */ if ((event_log_file = fopen(event_log_filename, "wb")) == NULL) { - sysErrorBelch("initEventLoggin: can't open %s", event_log_filename); + sysErrorBelch("initEventLogging: can't open %s", event_log_filename); stg_exit(EXIT_FAILURE); } @@ -242,6 +243,7 @@ initEventLogging(void) break; case EVENT_LOG_MSG: // (msg) + case EVENT_USER_MSG: // (msg) eventTypes[t].size = 0xffff; break; @@ -393,7 +395,7 @@ postSchedEvent (Capability *cap, #define BUF 512 -void postLogMsg(EventsBuf *eb, char *msg, va_list ap) +void postLogMsg(EventsBuf *eb, EventTypeNum type, char *msg, va_list ap) { char buf[BUF]; nat size; @@ -409,7 +411,7 @@ void postLogMsg(EventsBuf *eb, char *msg, va_list ap) printAndClearEventBuf(eb); } - postEventHeader(eb, EVENT_LOG_MSG); + postEventHeader(eb, type); postPayloadSize(eb, size); postBuf(eb,(StgWord8*)buf,size); } @@ -417,15 +419,20 @@ void postLogMsg(EventsBuf *eb, char *msg, va_list ap) void postMsg(char *msg, va_list ap) { ACQUIRE_LOCK(&eventBufMutex); - postLogMsg(&eventBuf, msg, ap); + postLogMsg(&eventBuf, EVENT_LOG_MSG, msg, ap); RELEASE_LOCK(&eventBufMutex); } void postCapMsg(Capability *cap, char *msg, va_list ap) { - postLogMsg(&capEventBuf[cap->no], msg, ap); + postLogMsg(&capEventBuf[cap->no], EVENT_LOG_MSG, msg, ap); } +void postUserMsg(Capability *cap, char *msg) +{ + postLogMsg(&capEventBuf[cap->no], EVENT_USER_MSG, msg, NULL); +} + void closeBlockMarker (EventsBuf *ebuf) { StgInt8* save_pos;