summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2009-04-23 14:19:40 +0000
committerSimon Marlow <marlowsd@gmail.com>2009-04-23 14:19:40 +0000
commitb5a73581d0c03b9d44a77706b5973d74074aa6c1 (patch)
tree52d8cd31bd42772d2c08274caccb29377706ac7a
parent2b569f55bdaaeb0cbff16f9e2bf90e14a2fb3139 (diff)
downloadhaskell-b5a73581d0c03b9d44a77706b5973d74074aa6c1.tar.gz
Add EVENT_CREATE_SPARK_THREAD to replace EVENT_SPARK_TO_THREAD
Also some tidyups and renaming
-rw-r--r--includes/EventLogFormat.h39
-rw-r--r--rts/Sparks.c7
-rw-r--r--rts/eventlog/EventLog.c28
3 files changed, 33 insertions, 41 deletions
diff --git a/includes/EventLogFormat.h b/includes/EventLogFormat.h
index dd9b212837..7b039beb84 100644
--- a/includes/EventLogFormat.h
+++ b/includes/EventLogFormat.h
@@ -96,23 +96,24 @@
/*
* Types of event
*/
-#define EVENT_CREATE_THREAD 0 /* (cap, thread) */
-#define EVENT_RUN_THREAD 1 /* (cap, thread) */
-#define EVENT_STOP_THREAD 2 /* (cap, thread, status) */
-#define EVENT_THREAD_RUNNABLE 3 /* (cap, thread) */
-#define EVENT_MIGRATE_THREAD 4 /* (cap, thread, new_cap) */
-#define EVENT_RUN_SPARK 5 /* (cap, thread) */
-#define EVENT_STEAL_SPARK 6 /* (cap, thread, victim_cap) */
-#define EVENT_SHUTDOWN 7 /* (cap) */
-#define EVENT_THREAD_WAKEUP 8 /* (cap, thread, other_cap) */
-#define EVENT_GC_START 9 /* (cap) */
-#define EVENT_GC_END 10 /* (cap) */
-#define EVENT_REQUEST_SEQ_GC 11 /* (cap) */
-#define EVENT_REQUEST_PAR_GC 12 /* (cap) */
-#define EVENT_CREATE_SPARK 13 /* (cap, thread) */
-#define EVENT_SPARK_TO_THREAD 14 /* (cap, thread, spark_thread) */
+#define EVENT_CREATE_THREAD 0 /* (cap, thread) */
+#define EVENT_RUN_THREAD 1 /* (cap, thread) */
+#define EVENT_STOP_THREAD 2 /* (cap, thread, status) */
+#define EVENT_THREAD_RUNNABLE 3 /* (cap, thread) */
+#define EVENT_MIGRATE_THREAD 4 /* (cap, thread, new_cap) */
+#define EVENT_RUN_SPARK 5 /* (cap, thread) */
+#define EVENT_STEAL_SPARK 6 /* (cap, thread, victim_cap) */
+#define EVENT_SHUTDOWN 7 /* (cap) */
+#define EVENT_THREAD_WAKEUP 8 /* (cap, thread, other_cap) */
+#define EVENT_GC_START 9 /* (cap) */
+#define EVENT_GC_END 10 /* (cap) */
+#define EVENT_REQUEST_SEQ_GC 11 /* (cap) */
+#define EVENT_REQUEST_PAR_GC 12 /* (cap) */
+#define EVENT_CREATE_SPARK 13 /* (cap, thread) */
+#define EVENT_SPARK_TO_THREAD 14 /* DEPRECATED! (cap, thread, spark_thread) */
+#define EVENT_CREATE_SPARK_THREAD 15 /* (cap, thread, spark_thread) */
-#define NUM_EVENT_TAGS 15
+#define NUM_EVENT_TAGS 16
/*
* Status values for EVENT_STOP_THREAD
@@ -130,8 +131,8 @@
#ifndef EVENTLOG_CONSTANTS_ONLY
typedef StgWord16 EventTypeNum;
-typedef StgWord64 Timestamp; // in nanoseconds
-typedef StgThreadID ThreadID;
-typedef StgWord16 CapNo;
+typedef StgWord64 EventTimestamp; // in nanoseconds
+typedef StgWord64 EventThreadID;
+typedef StgWord16 EventCapNo;
#endif
diff --git a/rts/Sparks.c b/rts/Sparks.c
index 7e89d46c66..2167de0dcf 100644
--- a/rts/Sparks.c
+++ b/rts/Sparks.c
@@ -58,12 +58,7 @@ createSparkThread (Capability *cap)
tso = createIOThread (cap, RtsFlags.GcFlags.initialStkSize,
&base_GHCziConc_runSparks_closure);
- if (cap->r.rCurrentTSO != NULL)
- // Capability in a bound thread?
- postEvent(cap, EVENT_SPARK_TO_THREAD, cap->r.rCurrentTSO->id, tso->id);
- else
- // Capability in a worker thread?
- postEvent(cap, EVENT_SPARK_TO_THREAD, 0, tso->id);
+ postEvent(cap, EVENT_CREATE_SPARK_THREAD, 0, tso->id);
appendToRunQueue(cap,tso);
}
diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c
index 990820fd92..098934c1ba 100644
--- a/rts/eventlog/EventLog.c
+++ b/rts/eventlog/EventLog.c
@@ -50,7 +50,8 @@ char *EventDesc[] = {
"Request sequential GC",
"Request parallel GC",
"Create spark",
- "Spark to thread"
+ "Spark to thread", /* DEPRECATED! */
+ "Create spark thread"
};
// Event type.
@@ -106,13 +107,13 @@ static inline void postWord64(EventsBuf *eb, StgWord64 i)
static inline void postEventTypeNum(EventsBuf *eb, EventTypeNum etNum)
{ postWord16(eb, etNum); }
-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)
@@ -183,24 +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);
- break;
-
- case EVENT_SPARK_TO_THREAD: // (cap, thread, spark_thread)
- eventTypes[t].size =
- sizeof(CapNo) + sizeof(ThreadID) + 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)
@@ -208,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;
}
@@ -315,9 +312,8 @@ postEvent_(Capability *cap, EventTypeNum tag, StgThreadID thread, StgWord64 othe
break;
}
- case EVENT_SPARK_TO_THREAD: // (cap, thread, spark_thread)
+ case EVENT_CREATE_SPARK_THREAD: // (cap, spark_thread)
{
- postThreadID(eb,thread);
postThreadID(eb,other /* spark_thread */);
break;
}
@@ -445,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.