Use snwprintf instead of swprintf in rts/Linker.c.
[ghc.git] / rts / Trace.h
index dcd00b8..31aefcb 100644 (file)
@@ -133,24 +133,24 @@ void traceGcEventAtT_ (Capability *cap, StgWord64 ts, EventTypeNum tag);
 void traceHeapEvent_ (Capability   *cap,
                       EventTypeNum  tag,
                       CapsetID      heap_capset,
-                      lnat          info1);
+                      W_          info1);
 
 void traceEventHeapInfo_ (CapsetID    heap_capset,
                           nat         gens,
-                          lnat        maxHeapSize,
-                          lnat        allocAreaSize,
-                          lnat        mblockSize,
-                          lnat        blockSize);
+                          W_        maxHeapSize,
+                          W_        allocAreaSize,
+                          W_        mblockSize,
+                          W_        blockSize);
 
 void traceEventGcStats_  (Capability *cap,
                           CapsetID    heap_capset,
                           nat         gen,
-                          lnat        copied,
-                          lnat        slop,
-                          lnat        fragmentation,
+                          W_        copied,
+                          W_        slop,
+                          W_        fragmentation,
                           nat         par_n_threads,
-                          lnat        par_max_copied,
-                          lnat        par_tot_copied);
+                          W_        par_max_copied,
+                          W_        par_tot_copied);
 
 /* 
  * Record a spark event
@@ -197,6 +197,12 @@ void trace_(char *msg, ...);
  */
 void traceUserMsg(Capability *cap, char *msg);
 
+/* 
+ * A marker event emitted by the program
+ * Used by Debug.Trace.{traceMarker, traceMarkerIO}
+ */
+void traceUserMarker(Capability *cap, char *msg);
+
 /*
  * An event to record a Haskell thread's label/name
  * Used by GHC.Conc.labelThread
@@ -310,6 +316,7 @@ INLINE_HEADER void traceEventStartup_ (int n_caps STG_UNUSED) {};
 #if !defined(DEBUG) && !defined(TRACING) && defined(DTRACE)
 
 void dtraceUserMsgWrapper(Capability *cap, char *msg);
+void dtraceUserMarkerWrapper(Capability *cap, char *msg);
 
 #endif /* !defined(DEBUG) && !defined(TRACING) && defined(DTRACE) */
 
@@ -356,6 +363,8 @@ INLINE_HEADER void dtraceStartup (int num_caps) {
     HASKELLEVENT_CAP_DISABLE(cap)
 #define dtraceUserMsg(cap, msg)                         \
     HASKELLEVENT_USER_MSG(cap, msg)
+#define dtraceUserMarker(cap, msg)                      \
+    HASKELLEVENT_USER_MARKER(cap, msg)
 #define dtraceGcIdle(cap)                               \
     HASKELLEVENT_GC_IDLE(cap)
 #define dtraceGcWork(cap)                               \
@@ -373,7 +382,7 @@ INLINE_HEADER void dtraceStartup (int num_caps) {
                            copies, slop, fragmentation, \
                            par_n_threads,               \
                            par_max_copied,              \
-                           par_tot_copied)              \
+                           par_tot_copied)
 #define dtraceHeapInfo(heap_capset, gens,               \
                        maxHeapSize, allocAreaSize,      \
                        mblockSize, blockSize)           \
@@ -412,8 +421,8 @@ INLINE_HEADER void dtraceStartup (int num_caps) {
     HASKELLEVENT_SPARK_FIZZLE(cap)
 #define dtraceSparkGc(cap)                              \
     HASKELLEVENT_SPARK_GC(cap)
-#define dtraceTaskCreate(taskID, cap)                   \
-    HASKELLEVENT_TASK_CREATE(taskID, cap)
+#define dtraceTaskCreate(taskID, cap, tid)              \
+    HASKELLEVENT_TASK_CREATE(taskID, cap, tid)
 #define dtraceTaskMigrate(taskID, cap, new_cap)         \
     HASKELLEVENT_TASK_MIGRATE(taskID, cap, new_cap)
 #define dtraceTaskDelete(taskID)                        \
@@ -435,6 +444,7 @@ INLINE_HEADER void dtraceStartup (int num_caps) {
 #define dtraceThreadLabel(cap, tso, label)              /* nothing */
 INLINE_HEADER void dtraceStartup (int num_caps STG_UNUSED) {};
 #define dtraceUserMsg(cap, msg)                         /* nothing */
+#define dtraceUserMarker(cap, msg)                      /* nothing */
 #define dtraceGcIdle(cap)                               /* nothing */
 #define dtraceGcWork(cap)                               /* nothing */
 #define dtraceGcDone(cap)                               /* nothing */
@@ -467,7 +477,7 @@ INLINE_HEADER void dtraceStartup (int num_caps STG_UNUSED) {};
 #define dtraceSparkSteal(cap, victim_cap)               /* nothing */
 #define dtraceSparkFizzle(cap)                          /* nothing */
 #define dtraceSparkGc(cap)                              /* nothing */
-#define dtraceTaskCreate(taskID, cap)                   /* nothing */
+#define dtraceTaskCreate(taskID, cap, tid)              /* nothing */
 #define dtraceTaskMigrate(taskID, cap, new_cap)         /* nothing */
 #define dtraceTaskDelete(taskID)                        /* nothing */
 
@@ -642,29 +652,29 @@ INLINE_HEADER void traceEventGcGlobalSync(Capability *cap STG_UNUSED)
 INLINE_HEADER void traceEventGcStats(Capability *cap            STG_UNUSED,
                                      CapsetID    heap_capset    STG_UNUSED,
                                      nat         gen            STG_UNUSED,
-                                     lnat        copied         STG_UNUSED,
-                                     lnat        slop           STG_UNUSED,
-                                     lnat        fragmentation  STG_UNUSED,
+                                     W_        copied         STG_UNUSED,
+                                     W_        slop           STG_UNUSED,
+                                     W_        fragmentation  STG_UNUSED,
                                      nat         par_n_threads  STG_UNUSED,
-                                     lnat        par_max_copied STG_UNUSED,
-                                     lnat        par_tot_copied STG_UNUSED)
+                                     W_        par_max_copied STG_UNUSED,
+                                     W_        par_tot_copied STG_UNUSED)
 {
     if (RTS_UNLIKELY(TRACE_gc)) {
         traceEventGcStats_(cap, heap_capset, gen,
                            copied, slop, fragmentation,
                            par_n_threads, par_max_copied, par_tot_copied);
     }
-    dtraceEventGcStats(heap_capset, gens,
-                       copies, slop, fragmentation,
+    dtraceEventGcStats(heap_capset, gen,
+                       copied, slop, fragmentation,
                        par_n_threads, par_max_copied, par_tot_copied);
 }
 
 INLINE_HEADER void traceEventHeapInfo(CapsetID    heap_capset   STG_UNUSED,
                                       nat         gens          STG_UNUSED,
-                                      lnat        maxHeapSize   STG_UNUSED,
-                                      lnat        allocAreaSize STG_UNUSED,
-                                      lnat        mblockSize    STG_UNUSED,
-                                      lnat        blockSize     STG_UNUSED)
+                                      W_        maxHeapSize   STG_UNUSED,
+                                      W_        allocAreaSize STG_UNUSED,
+                                      W_        mblockSize    STG_UNUSED,
+                                      W_        blockSize     STG_UNUSED)
 {
     if (RTS_UNLIKELY(TRACE_gc)) {
         traceEventHeapInfo_(heap_capset, gens,
@@ -678,7 +688,7 @@ INLINE_HEADER void traceEventHeapInfo(CapsetID    heap_capset   STG_UNUSED,
 
 INLINE_HEADER void traceEventHeapAllocated(Capability *cap         STG_UNUSED,
                                            CapsetID    heap_capset STG_UNUSED,
-                                           lnat        allocated   STG_UNUSED)
+                                           W_        allocated   STG_UNUSED)
 {
     traceHeapEvent(cap, EVENT_HEAP_ALLOCATED, heap_capset, allocated);
     dtraceEventHeapAllocated((EventCapNo)cap->no, heap_capset, allocated);
@@ -686,7 +696,7 @@ INLINE_HEADER void traceEventHeapAllocated(Capability *cap         STG_UNUSED,
 
 INLINE_HEADER void traceEventHeapSize(Capability *cap         STG_UNUSED,
                                       CapsetID    heap_capset STG_UNUSED,
-                                      lnat        heap_size   STG_UNUSED)
+                                      W_        heap_size   STG_UNUSED)
 {
     traceHeapEvent(cap, EVENT_HEAP_SIZE, heap_capset, heap_size);
     dtraceEventHeapSize(heap_capset, heap_size);
@@ -694,7 +704,7 @@ INLINE_HEADER void traceEventHeapSize(Capability *cap         STG_UNUSED,
 
 INLINE_HEADER void traceEventHeapLive(Capability *cap         STG_UNUSED,
                                       CapsetID    heap_capset STG_UNUSED,
-                                      lnat        heap_live   STG_UNUSED)
+                                      W_        heap_live   STG_UNUSED)
 {
     traceHeapEvent(cap, EVENT_HEAP_LIVE, heap_capset, heap_live);
     dtraceEventHeapLive(heap_capset, heap_live);
@@ -837,7 +847,9 @@ INLINE_HEADER void traceTaskCreate(Task       *task STG_UNUSED,
     if (RTS_UNLIKELY(TRACE_sched)) {
         traceTaskCreate_(task, cap);
     }
-    dtraceTaskCreate(serialisableTaskId(task), (EventCapNo)cap->no);
+    dtraceTaskCreate(serialisableTaskId(task),
+                     (EventCapNo)cap->no,
+                     kernelThreadId());
 }
 
 INLINE_HEADER void traceTaskMigrate(Task       *task    STG_UNUSED,