Commit e8d7985d authored by donnie@darthik.com's avatar donnie@darthik.com

Eventlog support for new event type: create spark.

parent 2a21b894
......@@ -109,8 +109,9 @@
#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 NUM_EVENT_TAGS 13
#define NUM_EVENT_TAGS 14
/*
* Status values for EVENT_STOP_THREAD
......
......@@ -79,6 +79,10 @@ findSpark (Capability *cap)
spark = tryStealSpark(cap);
if (spark != NULL) {
cap->sparks_converted++;
// Post event for running a spark from capability's own pool.
postEvent(cap, EVENT_RUN_SPARK, cap->r.rCurrentTSO->id, 0);
return spark;
}
......@@ -113,6 +117,11 @@ findSpark (Capability *cap)
"cap %d: Stole a spark from capability %d",
cap->no, robbed->no);
cap->sparks_converted++;
postEvent(cap, EVENT_STEAL_SPARK,
cap->r.rCurrentTSO->id, robbed->no);
return spark;
}
// otherwise: no success, try next one
......
......@@ -858,7 +858,7 @@ schedulePushWork(Capability *cap USED_IF_THREADS,
debugTrace(DEBUG_sched, "pushing thread %lu to capability %d", (unsigned long)t->id, free_caps[i]->no);
appendToRunQueue(free_caps[i],t);
postEvent (cap, EVENT_MIGRATE_THREAD, t->id, free_caps[i]->no);
postEvent (cap, EVENT_MIGRATE_THREAD, t->id, free_caps[i]->no);
if (t->bound) { t->bound->cap = free_caps[i]; }
t->cap = free_caps[i];
......@@ -881,6 +881,9 @@ schedulePushWork(Capability *cap USED_IF_THREADS,
spark = tryStealSpark(cap->sparks);
if (spark != NULL) {
debugTrace(DEBUG_sched, "pushing spark %p to capability %d", spark, free_caps[i]->no);
postEvent(free_caps[i], EVENT_STEAL_SPARK, t->id, cap->no);
newSpark(&(free_caps[i]->r), spark);
}
}
......
......@@ -57,6 +57,7 @@ createSparkThread (Capability *cap)
tso = createIOThread (cap, RtsFlags.GcFlags.initialStkSize,
&base_GHCziConc_runSparks_closure);
appendToRunQueue(cap,tso);
}
......@@ -83,6 +84,8 @@ newSpark (StgRegTable *reg, StgClosure *p)
cap->sparks_created++;
postEvent(cap, EVENT_CREATE_SPARK, reg->rCurrentTSO->id, 0);
return 1;
}
......
......@@ -48,7 +48,8 @@ char *EventDesc[] = {
"Request sequential GC",
"Request parallel GC",
"Starting GC",
"Finished GC"
"Finished GC",
"Create spark"
};
// Event type.
......@@ -176,6 +177,7 @@ initEventLogging(void)
case EVENT_CREATE_THREAD: // (cap, thread)
case EVENT_RUN_THREAD: // (cap, thread)
case EVENT_THREAD_RUNNABLE: // (cap, thread)
case EVENT_CREATE_SPARK: // (cap, thread)
case EVENT_RUN_SPARK: // (cap, thread)
eventTypes[t].size = sizeof(CapabilityNum) + sizeof(ThreadID);
break;
......@@ -298,6 +300,7 @@ postEvent_(Capability *cap, EventTypeNum tag, StgThreadID thread, nat other_cap)
case EVENT_CREATE_THREAD: // (cap, thread)
case EVENT_RUN_THREAD: // (cap, thread)
case EVENT_THREAD_RUNNABLE: // (cap, thread)
case EVENT_CREATE_SPARK: // (cap, thread)
case EVENT_RUN_SPARK: // (cap, thread)
{
postWord64(eb,thread);
......
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