"Steal spark",
"Shutdown",
"Wakeup thread",
+ "Starting GC",
+ "Finished GC",
"Request sequential GC",
"Request parallel GC",
- "Starting GC",
- "Finished GC"
+ "Create spark",
+ "Spark to thread", /* DEPRECATED! */
+ "Create spark thread"
};
// Event type.
static StgBool hasRoomForEvent(EventsBuf *eb, EventTypeNum eNum);
-static inline void postInt8(EventsBuf *eb, StgInt8 i);
-static inline void postInt16(EventsBuf *eb, StgInt16 i);
-static inline void postInt32(EventsBuf *eb, StgInt32 i);
-static inline void postInt64(EventsBuf *eb, StgInt64 i);
-static inline void postWord8(EventsBuf *eb, StgWord8 i);
-static inline void postWord16(EventsBuf *eb, StgWord16 i);
-static inline void postWord32(EventsBuf *eb, StgWord32 i);
-static inline void postWord64(EventsBuf *eb, StgWord64 i);
+static inline void postWord8(EventsBuf *eb, StgWord8 i)
+{
+ *(eb->pos++) = i;
+}
+
+static inline void postWord16(EventsBuf *eb, StgWord16 i)
+{
+ postWord8(eb, (StgWord8)(i >> 8));
+ postWord8(eb, (StgWord8)i);
+}
+
+static inline void postWord32(EventsBuf *eb, StgWord32 i)
+{
+ postWord16(eb, (StgWord16)(i >> 16));
+ postWord16(eb, (StgWord16)i);
+}
+
+static inline void postWord64(EventsBuf *eb, StgWord64 i)
+{
+ postWord32(eb, (StgWord32)(i >> 32));
+ postWord32(eb, (StgWord32)i);
+}
+
+static inline void postEventTypeNum(EventsBuf *eb, EventTypeNum etNum)
+{ postWord16(eb, etNum); }
+
+static inline void postTimestamp(EventsBuf *eb, EventTimestamp t)
+{ postWord64(eb,t); }
+
+static inline void postThreadID(EventsBuf *eb, EventThreadID id)
+{ postWord32(eb,id); }
+
+static inline void postCapNo(EventsBuf *eb, EventCapNo no)
+{ postWord16(eb,no); }
+
+static inline void postInt8(EventsBuf *eb, StgInt8 i)
+{ postWord8(eb, (StgWord8)i); }
+
+static inline void postInt16(EventsBuf *eb, StgInt16 i)
+{ postWord16(eb, (StgWord16)i); }
+
+static inline void postInt32(EventsBuf *eb, StgInt32 i)
+{ postWord32(eb, (StgWord32)i); }
+
+static inline void postInt64(EventsBuf *eb, StgInt64 i)
+{ postWord64(eb, (StgWord64)i); }
-static inline void postEventTypeNum(EventsBuf *eb, EventTypeNum etNum);
-static inline void postTimestamp(EventsBuf *eb, Timestamp t);
void
initEventLogging(void)
case EVENT_CREATE_THREAD: // (cap, thread)
case EVENT_RUN_THREAD: // (cap, thread)
case EVENT_THREAD_RUNNABLE: // (cap, thread)
+ case EVENT_CREATE_SPARK: // (cap, thread)
case EVENT_RUN_SPARK: // (cap, thread)
- eventTypes[t].size = sizeof(CapabilityNum) + sizeof(ThreadID);
+ case EVENT_CREATE_SPARK_THREAD: // (cap, spark_thread)
+ eventTypes[t].size = sizeof(EventCapNo) + sizeof(EventThreadID);
break;
case EVENT_MIGRATE_THREAD: // (cap, thread, new_cap)
case EVENT_STEAL_SPARK: // (cap, thread, victim_cap)
case EVENT_THREAD_WAKEUP: // (cap, thread, other_cap)
eventTypes[t].size =
- sizeof(CapabilityNum) + sizeof(ThreadID) +
- sizeof(CapabilityNum);
+ sizeof(EventCapNo) + sizeof(EventThreadID) + sizeof(EventCapNo);
break;
case EVENT_STOP_THREAD: // (cap, thread, status)
eventTypes[t].size =
- sizeof(CapabilityNum) + sizeof(ThreadID) + sizeof(StgWord16);
+ sizeof(EventCapNo) + sizeof(EventThreadID) + sizeof(StgWord16);
break;
case EVENT_SHUTDOWN: // (cap)
case EVENT_REQUEST_PAR_GC: // (cap)
case EVENT_GC_START: // (cap)
case EVENT_GC_END: // (cap)
- eventTypes[t].size = sizeof(CapabilityNum);
+ eventTypes[t].size = sizeof(EventCapNo);
break;
}
* If the buffer is full, prints out the buffer and clears it.
*/
void
-postEvent_(Capability *cap, EventTypeNum tag, StgThreadID thread, nat other_cap)
+postEvent_(Capability *cap, EventTypeNum tag, StgThreadID thread, StgWord64 other)
{
EventsBuf *eb;
postEventTypeNum(eb, tag);
postTimestamp(eb, stat_getElapsedTime() * (1000000000LL/TICKS_PER_SECOND));
- postWord16(eb, cap->no);
+ postCapNo(eb, cap->no);
switch (tag) {
case EVENT_CREATE_THREAD: // (cap, thread)
case EVENT_RUN_THREAD: // (cap, thread)
case EVENT_THREAD_RUNNABLE: // (cap, thread)
+ case EVENT_CREATE_SPARK: // (cap, thread)
case EVENT_RUN_SPARK: // (cap, thread)
{
- postWord64(eb,thread);
+ postThreadID(eb,thread);
+ break;
+ }
+
+ case EVENT_CREATE_SPARK_THREAD: // (cap, spark_thread)
+ {
+ postThreadID(eb,other /* spark_thread */);
break;
}
case EVENT_STEAL_SPARK: // (cap, thread, victim_cap)
case EVENT_THREAD_WAKEUP: // (cap, thread, other_cap)
{
- postWord64(eb,thread);
- postWord16(eb,other_cap);
+ postThreadID(eb,thread);
+ postCapNo(eb,other /* new_cap | victim_cap | other_cap */);
break;
}
case EVENT_STOP_THREAD: // (cap, thread, status)
{
- postWord64(eb,thread);
- postWord16(eb,other_cap);
+ postThreadID(eb,thread);
+ postWord16(eb,other /* status */);
break;
}
{
nat size = 0;
- size += sizeof(EventTypeNum) + sizeof(Timestamp) + eventTypes[eNum].size;
+ size += sizeof(EventTypeNum) + sizeof(EventTimestamp) + eventTypes[eNum].size;
if (eb->pos + size > eb->begin + eb->size) {
return 0; // Not enough space.
postInt32(eb, EVENT_ET_END);
}
-static inline void postEventTypeNum(EventsBuf *eb, EventTypeNum etNum)
-{ postWord16(eb, etNum); }
-
-static inline void postEventTypeID(EventsBuf *eb, StgWord16 etID)
-{ postWord16(eb, etID); }
-
-static inline void postTimestamp(EventsBuf *eb, Timestamp t)
-{ postWord64(eb,t); }
-
-static inline void postInt8(EventsBuf *eb, StgInt8 i)
-{ postWord8(eb, (StgWord8)i); }
-
-static inline void postInt16(EventsBuf *eb, StgInt16 i)
-{ postWord16(eb, (StgWord16)i); }
-
-static inline void postInt32(EventsBuf *eb, StgInt32 i)
-{ postWord32(eb, (StgWord32)i); }
-
-static inline void postInt64(EventsBuf *eb, StgInt64 i)
-{ postWord64(eb, (StgWord64)i); }
-
-static inline void postWord8(EventsBuf *eb, StgWord8 i)
-{
- *(eb->pos++) = i;
-}
-
-static inline void postWord16(EventsBuf *eb, StgWord16 i)
-{
- postWord8(eb, (StgWord8)(i >> 8));
- postWord8(eb, (StgWord8)i);
-}
-
-static inline void postWord32(EventsBuf *eb, StgWord32 i)
-{
- postWord16(eb, (StgWord16)(i >> 16));
- postWord16(eb, (StgWord16)i);
-}
-
-static inline void postWord64(EventsBuf *eb, StgWord64 i)
-{
- postWord32(eb, (StgWord32)(i >> 32));
- postWord32(eb, (StgWord32)i);
-}
-
#endif /* EVENTLOG */