Commit b5a73581 authored by Simon Marlow's avatar Simon Marlow

Add EVENT_CREATE_SPARK_THREAD to replace EVENT_SPARK_TO_THREAD

Also some tidyups and renaming
parent 2b569f55
......@@ -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
......@@ -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);
}
......
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment