Commit b1faf662 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Move tic/toc out of SWIFT_DEBUG_TASKS sections, but keep the...

Move tic/toc out of SWIFT_DEBUG_TASKS sections, but keep the --enable-task-debugging configure option as that also requires another two fields that we don't otherwise need
parent ffbf5ae5
......@@ -196,8 +196,17 @@ if test "x$enable_debug" = "xyes"; then
fi
fi
# We always do this now...
AC_DEFINE([SWIFT_DEBUG_TASKS],1,[Enable task timing])
# Check if task debugging is on.
AC_ARG_ENABLE([task-debugging],
[AS_HELP_STRING([--enable-task-debugging],
[Store extra information for generating task dump files @<:@yes/no@:>@]
)],
[enable_task_debugging="$enableval"],
[enable_task_debugging="no"]
)
if test "$enable_task_debugging" = "yes"; then
AC_DEFINE([SWIFT_DEBUG_TASKS],1,[Enable task debugging])
fi
# Check if threadpool debugging is on.
AC_ARG_ENABLE([threadpool-debugging],
......
......@@ -2889,9 +2889,7 @@ void engine_step(struct engine *e) {
struct clocks_time time1, time2;
clocks_gettime(&time1);
#ifdef SWIFT_DEBUG_TASKS
e->tic_step = getticks();
#endif
if (e->nodeID == 0) {
......@@ -3048,10 +3046,8 @@ void engine_step(struct engine *e) {
clocks_gettime(&time2);
e->wallclock_time = (float)clocks_diff(&time1, &time2);
#ifdef SWIFT_DEBUG_TASKS
/* Time in ticks at the end of this step. */
e->toc_step = getticks();
#endif
}
/**
......
......@@ -289,10 +289,8 @@ struct engine {
struct proxy *proxies;
int nr_proxies, *proxy_ind;
#ifdef SWIFT_DEBUG_TASKS
/* Tic/toc at the start/end of a step. */
ticks tic_step, toc_step;
#endif
#ifdef WITH_MPI
/* CPU time of the last step. */
......
......@@ -1595,9 +1595,9 @@ struct task *scheduler_addtask(struct scheduler *s, enum task_types type,
t->nr_unlock_tasks = 0;
#ifdef SWIFT_DEBUG_TASKS
t->rid = -1;
#endif
t->tic = 0;
t->toc = 0;
#endif
/* Add an index for it. */
// lock_lock( &s->lock );
......@@ -2030,14 +2030,14 @@ 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
/* Reset all task timers. */
for (int i = 0; i < s->nr_tasks; ++i) {
s->tasks[i].tic = 0;
s->tasks[i].toc = 0;
#ifdef SWIFT_DEBUG_TASKS
s->tasks[i].rid = -1;
}
#endif
}
/* Re-wait the tasks. */
if (s->active_count > 1000) {
......@@ -2289,9 +2289,7 @@ struct task *scheduler_done(struct scheduler *s, struct task *t) {
/* Task definitely done, signal any sleeping runners. */
if (!t->implicit) {
#ifdef SWIFT_DEBUG_TASKS
t->toc = getticks();
#endif
pthread_mutex_lock(&s->sleep_mutex);
atomic_dec(&s->waiting);
pthread_cond_broadcast(&s->sleep_cond);
......@@ -2332,9 +2330,7 @@ struct task *scheduler_unlock(struct scheduler *s, struct task *t) {
/* Task definitely done. */
if (!t->implicit) {
#ifdef SWIFT_DEBUG_TASKS
t->toc = getticks();
#endif
pthread_mutex_lock(&s->sleep_mutex);
atomic_dec(&s->waiting);
pthread_cond_broadcast(&s->sleep_cond);
......@@ -2418,13 +2414,13 @@ struct task *scheduler_gettask(struct scheduler *s, int qid,
}
}
#ifdef SWIFT_DEBUG_TASKS
/* Start the timer on this task, if we got one. */
if (res != NULL) {
res->tic = getticks();
#ifdef SWIFT_DEBUG_TASKS
res->rid = qid;
}
#endif
}
/* No milk today. */
return res;
......
......@@ -185,10 +185,10 @@ struct task {
/*! Information about the direction of the pair task */
short int sid;
#endif
/*! Start and end time of this task */
ticks tic, toc;
#endif
#ifdef SWIFT_DEBUG_CHECKS
/* When was this task last run? */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment