+ Called at the beginning of each Retainer Profiliing
+ -------------------------------------------------------------------------- */
+#ifdef PROFILING
+void
+stat_startRP(void)
+{
+ getTimes();
+ RP_start_time = CurrentUserTime;
+ RPe_start_time = CurrentElapsedTime;
+}
+#endif /* PROFILING */
+
+/* -----------------------------------------------------------------------------
+ Called at the end of each Retainer Profiliing
+ -------------------------------------------------------------------------- */
+
+#ifdef PROFILING
+void
+stat_endRP(
+ nat retainerGeneration,
+#ifdef DEBUG_RETAINER
+ nat maxCStackSize,
+ int maxStackSize,
+#endif
+ double averageNumVisit)
+{
+ getTimes();
+ RP_tot_time += CurrentUserTime - RP_start_time;
+ RPe_tot_time += CurrentElapsedTime - RPe_start_time;
+
+ fprintf(prof_file, "Retainer Profiling: %d, at %f seconds\n",
+ retainerGeneration, mut_user_time_during_RP());
+#ifdef DEBUG_RETAINER
+ fprintf(prof_file, "\tMax C stack size = %u\n", maxCStackSize);
+ fprintf(prof_file, "\tMax auxiliary stack size = %u\n", maxStackSize);
+#endif
+ fprintf(prof_file, "\tAverage number of visits per object = %f\n", averageNumVisit);
+}
+#endif /* PROFILING */
+
+/* -----------------------------------------------------------------------------
+ Called at the beginning of each heap census
+ -------------------------------------------------------------------------- */
+#ifdef PROFILING
+void
+stat_startHeapCensus(void)
+{
+ getTimes();
+ HC_start_time = CurrentUserTime;
+ HCe_start_time = CurrentElapsedTime;
+}
+#endif /* PROFILING */
+
+/* -----------------------------------------------------------------------------
+ Called at the end of each heap census
+ -------------------------------------------------------------------------- */
+#ifdef PROFILING
+void
+stat_endHeapCensus(void)
+{
+ getTimes();
+ HC_tot_time += CurrentUserTime - HC_start_time;
+ HCe_tot_time += CurrentElapsedTime - HCe_start_time;
+}
+#endif /* PROFILING */
+
+/* -----------------------------------------------------------------------------
+ stat_workerStop
+
+ Called under SMP when a worker thread finishes. We drop the timing
+ stats for this thread into the task_ids struct for that thread.
+ -------------------------------------------------------------------------- */
+
+#if defined(SMP)
+void
+stat_workerStop(void)
+{
+ nat i;
+ pthread_t me = pthread_self();
+
+ getTimes();
+
+ for (i = 0; i < RtsFlags.ParFlags.nNodes; i++) {
+ if (task_ids[i].id == me) {
+ task_ids[i].mut_time = CurrentUserTime - task_ids[i].gc_time;
+ task_ids[i].mut_etime = CurrentElapsedTime
+ - GCe_tot_time
+ - task_ids[i].elapsedtimestart;
+ if (task_ids[i].mut_time < 0.0) { task_ids[i].mut_time = 0.0; }
+ if (task_ids[i].mut_etime < 0.0) { task_ids[i].mut_etime = 0.0; }
+ }
+ }
+}
+#endif
+
+#if defined(SMP)
+long int stat_getElapsedTime ()
+{
+ getTimes();
+ return CurrentElapsedTime;
+}
+#endif
+
+/* -----------------------------------------------------------------------------