Do not link ghc stage1 using -threaded, only for stage2 or 3
[ghc-hetmet.git] / rts / eventlog / EventLog.c
index f950006..098934c 100644 (file)
@@ -49,7 +49,9 @@ char *EventDesc[] = {
   "Finished GC",
   "Request sequential GC",
   "Request parallel GC",
-  "Create spark"
+  "Create spark",
+  "Spark to thread", /* DEPRECATED! */
+  "Create spark thread"
 };
 
 // Event type. 
@@ -105,16 +107,13 @@ static inline void postWord64(EventsBuf *eb, StgWord64 i)
 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)
+static inline void postTimestamp(EventsBuf *eb, EventTimestamp t)
 { postWord64(eb,t); }
 
-static inline void postThreadID(EventsBuf *eb, ThreadID id)
+static inline void postThreadID(EventsBuf *eb, EventThreadID id)
 { postWord32(eb,id); }
 
-static inline void postCapNo(EventsBuf *eb, CapNo no)
+static inline void postCapNo(EventsBuf *eb, EventCapNo no)
 { postWord16(eb,no); }
 
 static inline void postInt8(EventsBuf *eb, StgInt8 i)
@@ -185,19 +184,20 @@ initEventLogging(void)
         case EVENT_THREAD_RUNNABLE: // (cap, thread)
         case EVENT_CREATE_SPARK:    // (cap, thread)
         case EVENT_RUN_SPARK:       // (cap, thread)
-            eventTypes[t].size = sizeof(CapNo) + 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(CapNo) + sizeof(ThreadID) + sizeof(CapNo);
+                sizeof(EventCapNo) + sizeof(EventThreadID) + sizeof(EventCapNo);
             break;
 
         case EVENT_STOP_THREAD:     // (cap, thread, status)
             eventTypes[t].size =
-                sizeof(CapNo) + sizeof(ThreadID) + sizeof(StgWord16);
+                sizeof(EventCapNo) + sizeof(EventThreadID) + sizeof(StgWord16);
             break;
 
         case EVENT_SHUTDOWN:        // (cap)
@@ -205,7 +205,7 @@ initEventLogging(void)
         case EVENT_REQUEST_PAR_GC:  // (cap)
         case EVENT_GC_START:        // (cap)
         case EVENT_GC_END:          // (cap)
-            eventTypes[t].size = sizeof(CapNo);
+            eventTypes[t].size = sizeof(EventCapNo);
             break;
         }
 
@@ -284,7 +284,7 @@ freeEventLogging(void)
  * 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;
 
@@ -312,6 +312,12 @@ postEvent_(Capability *cap, EventTypeNum tag, StgThreadID thread, nat other_cap)
         break;
     }
 
+    case EVENT_CREATE_SPARK_THREAD: // (cap, spark_thread)
+    {
+        postThreadID(eb,other /* spark_thread */);
+        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)
@@ -435,7 +441,7 @@ StgBool hasRoomForEvent(EventsBuf *eb, EventTypeNum eNum)
 {
   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.