Add capability sets to the tracing/events system
[ghc-hetmet.git] / rts / eventlog / EventLog.c
index d2e3de3..b5c2ef6 100644 (file)
@@ -79,11 +79,7 @@ char *EventDesc[] = {
   [EVENT_CAPSET_CREATE]       = "Create capability set",
   [EVENT_CAPSET_DELETE]       = "Delete capability set",
   [EVENT_CAPSET_ASSIGN_CAP]   = "Add capability to capability set",
-  [EVENT_CAPSET_REMOVE_CAP]   = "Remove capability from capability set",
-  [EVENT_RTS_IDENTIFIER]      = "Identify the RTS version",
-  [EVENT_PROGRAM_ARGS]        = "Identify the program arguments",
-  [EVENT_PROGRAM_ENV]         = "Identify the environment variables",
-  [EVENT_OSPROCESS_PID]       = "Identify the process ID of a capability set"
+  [EVENT_CAPSET_REMOVE_CAP]   = "Remove capability from capability set"
 };
 
 // Event type. 
@@ -288,11 +284,6 @@ initEventLogging(void)
                 sizeof(EventCapsetID) + sizeof(EventCapNo);
             break;
 
-        case EVENT_OSPROCESS_PID: // (cap, pid, parent pid)
-            eventTypes[t].size =
-                sizeof(EventCapsetID) + 2*sizeof(StgWord32);
-            break;
-
         case EVENT_SHUTDOWN:        // (cap)
         case EVENT_REQUEST_SEQ_GC:  // (cap)
         case EVENT_REQUEST_PAR_GC:  // (cap)
@@ -306,9 +297,6 @@ initEventLogging(void)
 
         case EVENT_LOG_MSG:          // (msg)
         case EVENT_USER_MSG:         // (msg)
-        case EVENT_RTS_IDENTIFIER:   // (capset, str)
-        case EVENT_PROGRAM_ARGS:     // (capset, strvec)
-        case EVENT_PROGRAM_ENV:      // (capset, strvec)
             eventTypes[t].size = 0xffff;
             break;
 
@@ -333,10 +321,6 @@ initEventLogging(void)
     
     // 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.
     /*
@@ -482,8 +466,7 @@ postSchedEvent (Capability *cap,
 
 void postCapsetModifyEvent (EventTypeNum tag,
                             EventCapsetID capset,
-                            StgWord32 other,
-                            StgWord32 other2)
+                            StgWord32 other)
 {
     ACQUIRE_LOCK(&eventBufMutex);
 
@@ -513,12 +496,6 @@ void postCapsetModifyEvent (EventTypeNum tag,
         postCapNo(&eventBuf, other /* capno */);
         break;
     }
-    case EVENT_OSPROCESS_PID:
-    {
-        postWord32(&eventBuf, other);
-        postWord32(&eventBuf, other2);
-        break;
-    }
     default:
         barf("postCapsetModifyEvent: unknown event tag %d", tag);
     }
@@ -526,70 +503,6 @@ void postCapsetModifyEvent (EventTypeNum tag,
     RELEASE_LOCK(&eventBufMutex);
 }
 
-void postCapsetStrEvent (EventTypeNum tag,
-                         EventCapsetID capset,
-                         char *msg)
-{
-    int strsize = strlen(msg);
-    int size = strsize + sizeof(EventCapsetID)
-
-    ACQUIRE_LOCK(&eventBufMutex);
-
-    if (!hasRoomForVariableEvent(&eventBuf, size)){
-        printAndClearEventBuf(&eventBuf);
-
-        if (!hasRoomForVariableEvent(&eventBuf, size)){
-            // Event size exceeds buffer size, bail out:
-            RELEASE_LOCK(&eventBufMutex);
-            return;
-        }
-    }
-
-    postEventHeader(&eventBuf, tag);
-    postPayloadSize(&eventBuf, size);
-    postCapsetID(&eventBuf, capset);
-
-    postBuf(&eventBuf, (StgWord8*) msg, strsize);
-
-    RELEASE_LOCK(&eventBufMutex);
-}
-
-void postCapsetVecEvent (EventTypeNum tag,
-                         EventCapsetID capset,
-                         int argc,
-                         char *argv[])
-{
-    int i, size = sizeof(EventCapsetID);
-
-    for (i = 0; i < argc; i++) {
-        // 1 + strlen to account for the trailing \0, used as separator
-        size += 1 + strlen(argv[i]);
-    }
-
-    ACQUIRE_LOCK(&eventBufMutex);
-
-    if (!hasRoomForVariableEvent(&eventBuf, size)){
-        printAndClearEventBuf(&eventBuf);
-
-        if(!hasRoomForVariableEvent(&eventBuf, size)){
-            // Event size exceeds buffer size, bail out:
-            RELEASE_LOCK(&eventBufMutex);
-            return;
-        }
-    }
-
-    postEventHeader(&eventBuf, tag);
-    postPayloadSize(&eventBuf, size);
-    postCapsetID(&eventBuf, capset);
-
-    for( i = 0; i < argc; i++ ) {
-        // again, 1 + to account for \0
-        postBuf(&eventBuf, (StgWord8*) argv[i], 1 + strlen(argv[i]));
-    }
-
-    RELEASE_LOCK(&eventBufMutex);
-}
-
 void
 postEvent (Capability *cap, EventTypeNum tag)
 {
@@ -645,6 +558,22 @@ void postUserMsg(Capability *cap, char *msg, va_list ap)
     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;