Commit 6f045438 authored by donnie@darthik.com's avatar donnie@darthik.com
Browse files

Added new EventLog event: Spark to Thread.

parent c29305da
......@@ -96,22 +96,23 @@
/*
* 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_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 NUM_EVENT_TAGS 14
#define NUM_EVENT_TAGS 15
/*
* Status values for EVENT_STOP_THREAD
......
......@@ -58,6 +58,13 @@ 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);
appendToRunQueue(cap,tso);
}
......
......@@ -49,7 +49,8 @@ char *EventDesc[] = {
"Finished GC",
"Request sequential GC",
"Request parallel GC",
"Create spark"
"Create spark",
"Spark to thread"
};
// Event type.
......@@ -188,6 +189,11 @@ initEventLogging(void)
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);
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)
......@@ -312,6 +318,13 @@ postEvent_(Capability *cap, EventTypeNum tag, StgThreadID thread, StgWord64 othe
break;
}
case EVENT_SPARK_TO_THREAD: // (cap, thread, spark_thread)
{
postThreadID(eb,thread);
postThreadID(eb,other /* spark_thread */);
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)
......
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