Rather than doing it differently for the eventlog and Dtrace cases.
#ifdef TRACING
initTracing();
#endif
- /* Dtrace events are always enabled
+ /* Trace the startup event
*/
- dtraceEventStartup();
+ traceEventStartup();
/* initialise scheduler data structures (needs to be done before
* initStorage()).
}
}
+void traceEventStartup_(int nocaps)
+{
+ if (eventlog_enabled) {
+ postEventStartup(nocaps);
+ }
+}
#ifdef DEBUG
void traceBegin (const char *str, ...)
void traceThreadStatus_ (StgTSO *tso);
+void traceEventStartup_ (int n_caps);
+
#else /* !TRACING */
#define traceSchedEvent(cap, tag, tso, other) /* nothing */
#define debugTrace(class, str, ...) /* nothing */
#define debugTraceCap(class, cap, str, ...) /* nothing */
#define traceThreadStatus(class, tso) /* nothing */
+#define traceEventStartup_(n_caps) /* nothing */
#endif /* TRACING */
dtraceCreateSparkThread((EventCapNo)cap->no, (EventThreadID)spark_tid);
}
-// This applies only to dtrace as EVENT_STARTUP in the logging framework is
-// handled specially in 'EventLog.c'.
-//
-INLINE_HEADER void dtraceEventStartup(void)
+INLINE_HEADER void traceEventStartup(void)
{
+ int n_caps;
#ifdef THREADED_RTS
// XXX n_capabilities hasn't been initislised yet
- dtraceStartup(RtsFlags.ParFlags.nNodes);
+ n_caps = RtsFlags.ParFlags.nNodes;
#else
- dtraceStartup(1);
+ n_caps = 1;
#endif
+
+ traceEventStartup_(n_caps);
+ dtraceStartup(n_caps);
}
INLINE_HEADER void traceEventGcIdle(Capability *cap STG_UNUSED)
// Prepare event buffer for events (data).
postInt32(&eventBuf, EVENT_DATA_BEGIN);
-
- // Post a STARTUP event with the number of capabilities
- postEventHeader(&eventBuf, EVENT_STARTUP);
- postCapNo(&eventBuf, n_caps);
// Flush capEventBuf with header.
/*
postLogMsg(&capEventBuf[cap->no], EVENT_USER_MSG, msg, ap);
}
+void postEventStartup(EventCapNo n_caps)
+{
+ ACQUIRE_LOCK(&eventBufMutex);
+
+ if (!hasRoomForEvent(&eventBuf, EVENT_STARTUP)) {
+ // Flush event buffer to make room for new event.
+ printAndClearEventBuf(&eventBuf);
+ }
+
+ // Post a STARTUP event with the number of capabilities
+ postEventHeader(&eventBuf, EVENT_STARTUP);
+ postCapNo(&eventBuf, n_caps);
+
+ RELEASE_LOCK(&eventBufMutex);
+}
+
void closeBlockMarker (EventsBuf *ebuf)
{
StgInt8* save_pos;
void postCapMsg(Capability *cap, char *msg, va_list ap);
+void postEventStartup(EventCapNo n_caps);
+
#else /* !TRACING */
INLINE_HEADER void postSchedEvent (Capability *cap STG_UNUSED,