#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
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;
}
"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
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];
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);
}
}
tso = createIOThread (cap, RtsFlags.GcFlags.initialStkSize,
&base_GHCziConc_runSparks_closure);
+
appendToRunQueue(cap,tso);
}
cap->sparks_created++;
+ postEvent(cap, EVENT_CREATE_SPARK, reg->rCurrentTSO->id, 0);
+
return 1;
}
"Request sequential GC",
"Request parallel GC",
"Starting GC",
- "Finished GC"
+ "Finished GC",
+ "Create spark"
};
// Event type.
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;
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);