From d26fa3b16b43e53b3ea575e5a63a9a87cd2ca7d5 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Tue, 9 May 2017 13:05:25 +0100
Subject: [PATCH] Reset the task debugging timers every time-step

---
 src/scheduler.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/scheduler.c b/src/scheduler.c
index e1074a32e9..9cf1598f6d 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -1107,6 +1107,15 @@ void scheduler_enqueue_mapper(void *map_data, int num_elements,
  */
 void scheduler_start(struct scheduler *s) {
 
+/* Reset all task debugging timers */
+#ifdef SWIFT_DEBUG_TASKS
+  for (int i = 0; i < s->nr_tasks; ++i) {
+    s->tasks[i].tic = 0;
+    s->tasks[i].toc = 0;
+    s->tasks[i].rid = -1;
+  }
+#endif
+
   /* Re-wait the tasks. */
   if (s->active_count > 1000) {
     threadpool_map(s->threadpool, scheduler_rewait_mapper, s->tid_active,
-- 
GitLab