diff --git a/src/runner.c b/src/runner.c index 98f957441292f3c6e51406e299ad76dcfc01b25c..f286326cfa80add202a54cbef0721d931ed0dbdc 100644 --- a/src/runner.c +++ b/src/runner.c @@ -489,31 +489,47 @@ void runner_dogsort(struct runner *r, struct cell *c, int flags, int clock) { * @param c The cell. */ -void runner_doinit(struct runner *r, struct cell *c) { +void runner_doinit(struct runner *r, struct cell *c, int timer) { struct part *p, *parts = c->parts; const int count = c->count; const float t_end = r->e->time; + + TIMER_TIC; /* Recurse? */ if (c->split) { for (int k = 0; k < 8; k++) - if (c->progeny[k] != NULL) runner_doinit(r, c->progeny[k]); + if (c->progeny[k] != NULL) runner_doinit(r, c->progeny[k], 0); return; } + else { - /* Loop over the parts in this cell. */ - for (int i = 0; i < count; i++) { - - /* Get a direct pointer on the part. */ - p = &parts[i]; - - if (p->t_end <= t_end) { - - /* Get ready for a density calculation */ - hydro_init_part(p); + /* Loop over the parts in this cell. */ + for (int i = 0; i < count; i++) { + + /* Get a direct pointer on the part. */ + p = &parts[i]; + + if (p->t_end <= t_end) { + + /* Get ready for a density calculation */ + hydro_init_part(p); + } } } + + if (timer) { +#ifdef TIMER_VERBOSE + message("runner %02i: %i parts at depth %i took %.3f ms.", r->id, c->count, + c->depth, ((double)TIMER_TOC(timer_init)) / CPU_TPS * 1000); + fflush(stdout); +#else + TIMER_TOC(timer_init); +#endif + } + + } /** @@ -1026,7 +1042,7 @@ void *runner_main(void *data) { error("Unknown task subtype."); break; case task_type_init: - runner_doinit(r, ci); + runner_doinit(r, ci, 1); break; case task_type_ghost: runner_doghost(r, ci); diff --git a/src/runner.h b/src/runner.h index 366c4f7af6ec94c0b366da85b21713600d559dc0..ff2f93db6eae9d9e85cd9c3de6f398ed0f64c681 100644 --- a/src/runner.h +++ b/src/runner.h @@ -52,7 +52,7 @@ void runner_dosort(struct runner *r, struct cell *c, int flag, int clock); void runner_dogsort(struct runner *r, struct cell *c, int flag, int clock); void runner_dokick(struct runner *r, struct cell *c, int timer); void runner_dodrift(struct runner *r, struct cell *c, int timer); -void runner_doinit(struct runner *r, struct cell *c); +void runner_doinit(struct runner *r, struct cell *c, int timer); void *runner_main(void *data); #endif /* SWIFT_RUNNER_H */ diff --git a/src/timers.h b/src/timers.h index 4ae56e5e672fa4a5da947312f424c7cef8e61fd2..95db02c5b8ea055e4b8264a7055c678460c29fdf 100644 --- a/src/timers.h +++ b/src/timers.h @@ -27,6 +27,7 @@ enum { timer_none = 0, timer_prepare, + timer_init, timer_drift, timer_kick, timer_dosort,