Add capability sets to the tracing/events system
[ghc-hetmet.git] / rts / Trace.c
index fb8e922..faa54d7 100644 (file)
 #include "Threads.h"
 #include "Printer.h"
 
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
 #ifdef DEBUG
 // debugging flags, set with +RTS -D<something>
 int DEBUG_sched;
@@ -257,8 +253,7 @@ void traceSchedEvent_ (Capability *cap, EventTypeNum tag,
 
 void traceCapsetModify_ (EventTypeNum tag,
                          CapsetID capset,
-                         StgWord32 other,
-                         StgWord32 other2)
+                         StgWord32 other)
 {
 #ifdef DEBUG
     if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
@@ -283,38 +278,9 @@ void traceCapsetModify_ (EventTypeNum tag,
     } else
 #endif
     {
-        if(eventlog_enabled) postCapsetModifyEvent(tag, capset, other, other2);
-    }
-}
-
-extern char **environ;
-
-void traceCapsetDetails_(int *argc, char **argv[]){
-    if(eventlog_enabled){
-        postCapsetModifyEvent(EVENT_OSPROCESS_PID,
-                              CAPSET_OSPROCESS_DEFAULT,
-                              getpid(),
-                              getppid());
-
-        char buf[256];
-        snprintf(buf, sizeof(buf), "GHC-%s %s", ProjectVersion, RtsWay);
-        postCapsetStrEvent(EVENT_RTS_IDENTIFIER,
-                           CAPSET_OSPROCESS_DEFAULT,
-                           buf);
-
-        if(argc != NULL && argv != NULL){
-            postCapsetVecEvent(EVENT_PROGRAM_ARGS,
-                               CAPSET_OSPROCESS_DEFAULT,
-                               *argc,
-                               *argv);
+        if (eventlog_enabled) {
+            postCapsetModifyEvent(tag, capset, other);
         }
-
-        int env_len;
-        for( env_len = 0; environ[env_len] != NULL; env_len++);
-        postCapsetVecEvent(EVENT_PROGRAM_ENV,
-                           CAPSET_OSPROCESS_DEFAULT,
-                           env_len,
-                           environ);
     }
 }
 
@@ -426,6 +392,12 @@ void traceThreadStatus_ (StgTSO *tso USED_IF_DEBUG)
     }
 }
 
+void traceEventStartup_(int nocaps)
+{
+    if (eventlog_enabled) {
+        postEventStartup(nocaps);
+    }
+}
 
 #ifdef DEBUG
 void traceBegin (const char *str, ...)