From 4c6c814f1ede09beba7f22a24e2dc729fa8db2a4 Mon Sep 17 00:00:00 2001
From: Aidan Chalk <aidan.chalk@stfc.ac.uk>
Date: Tue, 25 Apr 2017 16:41:46 +0100
Subject: [PATCH] Update to #15, now TASKTIMERS is output and configure is
 fixed

---
 configure.ac | 17 +++++++++--------
 src/qsched.c |  8 ++++----
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index 08930b8..8d1defb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -99,22 +99,23 @@ if test "$enable_san" = "yes"; then
    fi
 fi
 
+
+# Autoconf stuff
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+AC_HEADER_STDC
+
 AC_ARG_ENABLE([task-timers],
    [AS_HELP_STRING([--enable-task-timers],
-      [Enables task timer output and collection of extra data to enable it])].
-    [enable_tts]="$enableval$"],
-    [enable_tts]="no"]
+      [Enables task timer output and collection of extra data to enable it])],
+    [enable_tts="$enableval"],
+    [enable_tts="no"]
 )
 
 if test "$enable_tts" = "yes"; then
   AC_DEFINE(WITH_TASK_TIMERS,1,[Define if Task Timer recording is enabled])
 fi
 
-# Autoconf stuff
-AC_PROG_INSTALL
-AC_PROG_MAKE_SET
-AC_HEADER_STDC
-
 # Check for pthreads.
 AX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
     CC="$PTHREAD_CC" LDFLAGS="$LDFLAGS $PTHREAD_LIBS $LIBS"]
diff --git a/src/qsched.c b/src/qsched.c
index b21a830..86900ad 100644
--- a/src/qsched.c
+++ b/src/qsched.c
@@ -609,7 +609,7 @@ void qsched_done ( struct qsched *s , struct task *t ) {
     /* Set the task stats. */
     t->toc = getticks();
     #ifdef WITH_TASK_TIMERS
-    t->tid = qsched_get_tid();
+    t->tid = omp_get_thread_num();
     #endif
     if (!(s->flags & qsched_flag_norecost))
         t->cost = t->toc - t->tic;
@@ -1658,11 +1658,11 @@ FILE *task_file;
 
 task_file = fopen(filename, "w");
 
-for(int i = 0; i < s->nr_tasks; i++)
+for(int i = 0; i < s->count; i++)
 {
-    struct task *t = s->tasks[i];
+    struct task *t = &s->tasks[i];
     
-    fprintf("%i %i %lli %lli\n", t->type, t->tid, t->tic, t->toc);
+    fprintf(task_file,"%i %i %lli %lli\n", t->type, t->tid, t->tic, t->toc);
 
 }
 
-- 
GitLab