+ ACQUIRE_LOCK(&trace_utx);
+
+ tracePreface();
+ switch (tag) {
+ case EVENT_CREATE_THREAD: // (cap, thread)
+ debugBelch("cap %d: created thread %lu\n",
+ cap->no, (lnat)tso->id);
+ break;
+ case EVENT_RUN_THREAD: // (cap, thread)
+ debugBelch("cap %d: running thread %lu (%s)\n",
+ cap->no, (lnat)tso->id, what_next_strs[tso->what_next]);
+ break;
+ case EVENT_THREAD_RUNNABLE: // (cap, thread)
+ debugBelch("cap %d: thread %lu appended to run queue\n",
+ cap->no, (lnat)tso->id);
+ break;
+ case EVENT_RUN_SPARK: // (cap, thread)
+ debugBelch("cap %d: thread %lu running a spark\n",
+ cap->no, (lnat)tso->id);
+ break;
+ case EVENT_CREATE_SPARK_THREAD: // (cap, spark_thread)
+ debugBelch("cap %d: creating spark thread %lu\n",
+ cap->no, (long)other);
+ break;
+ case EVENT_MIGRATE_THREAD: // (cap, thread, new_cap)
+ debugBelch("cap %d: thread %lu migrating to cap %d\n",
+ cap->no, (lnat)tso->id, (int)other);
+ break;
+ case EVENT_STEAL_SPARK: // (cap, thread, victim_cap)
+ debugBelch("cap %d: thread %lu stealing a spark from cap %d\n",
+ cap->no, (lnat)tso->id, (int)other);
+ break;
+ case EVENT_THREAD_WAKEUP: // (cap, thread, other_cap)
+ debugBelch("cap %d: waking up thread %lu on cap %d\n",
+ cap->no, (lnat)tso->id, (int)other);
+ break;
+
+ case EVENT_STOP_THREAD: // (cap, thread, status)
+ debugBelch("cap %d: thread %lu stopped (%s)\n",
+ cap->no, (lnat)tso->id, thread_stop_reasons[other]);
+ break;
+ case EVENT_SHUTDOWN: // (cap)
+ debugBelch("cap %d: shutting down\n", cap->no);
+ break;
+ case EVENT_REQUEST_SEQ_GC: // (cap)
+ debugBelch("cap %d: requesting sequential GC\n", cap->no);
+ break;
+ case EVENT_REQUEST_PAR_GC: // (cap)
+ debugBelch("cap %d: requesting parallel GC\n", cap->no);
+ break;
+ case EVENT_GC_START: // (cap)
+ debugBelch("cap %d: starting GC\n", cap->no);
+ break;
+ case EVENT_GC_END: // (cap)
+ debugBelch("cap %d: finished GC\n", cap->no);
+ break;
+ default:
+ debugBelch("cap %2d: thread %lu: event %d\n\n",
+ cap->no, (lnat)tso->id, tag);
+ break;
+ }
+
+ RELEASE_LOCK(&trace_utx);
+}
+#endif