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

Eradicate the use of CPU_TPS in all code, replacing with clocks

functions. CPU_TPS is now only found in one Makefile.am and one
file, clocks.c.

Many of the uses are commented out or protected by TIMER_VERBOSE.
TIMER_VERBOSE no longer compiles, so these changes are untested
and just aim to guide the future...
parent e7b70154
...@@ -1117,7 +1117,7 @@ int engine_marktasks(struct engine *e) { ...@@ -1117,7 +1117,7 @@ int engine_marktasks(struct engine *e) {
} }
} }
// message( "took %.3f ms." , (double)(getticks() - tic)/CPU_TPS*1000 ); // message( "took %.3f ms." , clocks_from_ticks(getticks() - tic));
/* All is well... */ /* All is well... */
return 0; return 0;
...@@ -1168,29 +1168,29 @@ void engine_rebuild(struct engine *e) { ...@@ -1168,29 +1168,29 @@ void engine_rebuild(struct engine *e) {
/* Re-build the space. */ /* Re-build the space. */
// tic = getticks(); // tic = getticks();
space_rebuild(e->s, 0.0, e->nodeID == 0); space_rebuild(e->s, 0.0, e->nodeID == 0);
// message( "space_rebuild took %.3f ms." , (double)(getticks() - // message( "space_rebuild took %.3f ms." ,
// tic)/CPU_TPS*1000 ); //clocks_from_ticks(getticks() - tic));
/* If in parallel, exchange the cell structure. */ /* If in parallel, exchange the cell structure. */
#ifdef WITH_MPI #ifdef WITH_MPI
// tic = getticks(); // tic = getticks();
engine_exchange_cells(e); engine_exchange_cells(e);
// message( "engine_exchange_cells took %.3f ms." , (double)(getticks() - // message( "engine_exchange_cells took %.3f ms." ,
// tic)/CPU_TPS*1000 ); //clocks_from_ticks(getticks() - tic));
#endif #endif
/* Re-build the tasks. */ /* Re-build the tasks. */
// tic = getticks(); // tic = getticks();
engine_maketasks(e); engine_maketasks(e);
// message( "engine_maketasks took %.3f ms." , (double)(getticks() - // message( "engine_maketasks took %.3f ms." ,
// tic)/CPU_TPS*1000 ); //clocks_from_ticks(getticks() - tic));
/* Run through the tasks and mark as skip or not. */ /* Run through the tasks and mark as skip or not. */
// tic = getticks(); // tic = getticks();
if (engine_marktasks(e)) if (engine_marktasks(e))
error("engine_marktasks failed after space_rebuild."); error("engine_marktasks failed after space_rebuild.");
// message( "engine_marktasks took %.3f ms." , (double)(getticks() - // message( "engine_marktasks took %.3f ms." ,
// tic)/CPU_TPS*1000 ); //clocks_from_ticks(getticks() - tic));
/* Print the status of the system */ /* Print the status of the system */
engine_print(e); engine_print(e);
...@@ -1211,8 +1211,8 @@ void engine_prepare(struct engine *e) { ...@@ -1211,8 +1211,8 @@ void engine_prepare(struct engine *e) {
/* Run through the tasks and mark as skip or not. */ /* Run through the tasks and mark as skip or not. */
// tic = getticks(); // tic = getticks();
rebuild = (e->forcerebuild || engine_marktasks(e)); rebuild = (e->forcerebuild || engine_marktasks(e));
// message( "space_marktasks took %.3f ms." , (double)(getticks() - // message( "space_marktasks took %.3f ms." ,
// tic)/CPU_TPS*1000 ); //clocks_from_ticks((getticks() - tic)));
/* Collect the values of rebuild from all nodes. */ /* Collect the values of rebuild from all nodes. */
#ifdef WITH_MPI #ifdef WITH_MPI
...@@ -1222,8 +1222,8 @@ void engine_prepare(struct engine *e) { ...@@ -1222,8 +1222,8 @@ void engine_prepare(struct engine *e) {
MPI_SUCCESS) MPI_SUCCESS)
error("Failed to aggregate the rebuild flag across nodes."); error("Failed to aggregate the rebuild flag across nodes.");
rebuild = buff; rebuild = buff;
// message( "rebuild allreduce took %.3f ms." , (double)(getticks() - // message( "rebuild allreduce took %.3f ms." ,
// tic)/CPU_TPS*1000 ); //clocks_from_ticks(getticks() - tic));
#endif #endif
e->tic_step = getticks(); e->tic_step = getticks();
...@@ -1231,16 +1231,16 @@ void engine_prepare(struct engine *e) { ...@@ -1231,16 +1231,16 @@ void engine_prepare(struct engine *e) {
if (rebuild) { if (rebuild) {
// tic = getticks(); // tic = getticks();
engine_rebuild(e); engine_rebuild(e);
// message( "engine_rebuild took %.3f ms." , (double)(getticks() - // message( "engine_rebuild took %.3f ms." ,
// tic)/CPU_TPS*1000 ); //clocks_from_ticks(getticks() - tic));
} }
/* Re-rank the tasks every now and then. */ /* Re-rank the tasks every now and then. */
if (e->tasks_age % engine_tasksreweight == 1) { if (e->tasks_age % engine_tasksreweight == 1) {
// tic = getticks(); // tic = getticks();
scheduler_reweight(&e->sched); scheduler_reweight(&e->sched);
// message( "scheduler_reweight took %.3f ms." , (double)(getticks() - // message( "scheduler_reweight took %.3f ms." ,
// tic)/CPU_TPS*1000 ); //clocks_from_ticks(getticks() -tic));
} }
e->tasks_age += 1; e->tasks_age += 1;
...@@ -1626,8 +1626,8 @@ void engine_step(struct engine *e) { ...@@ -1626,8 +1626,8 @@ void engine_step(struct engine *e) {
clocks_gettime(&time2); clocks_gettime(&time2);
e->wallclock_time_ticks = e->wallclock_time_ticks =
((double)timers[timer_count - 1]) / clocks_cpufreq() * 1000; ((double)timers[timer_count - 1]) / clocks_get_cpufreq() * 1000;
e->wallclock_time = (float) clocks_diff(&time1, &time2); e->wallclock_time = (float) clocks_diff(&time1, &time2);
// printParticle(e->s->parts, e->s->xparts,1000, e->s->nr_parts); // printParticle(e->s->parts, e->s->xparts,1000, e->s->nr_parts);
......
...@@ -320,7 +320,7 @@ void runner_dosort(struct runner *r, struct cell *c, int flags, int clock) { ...@@ -320,7 +320,7 @@ void runner_dosort(struct runner *r, struct cell *c, int flags, int clock) {
(flags & 0x80) >> 7, (flags & 0x40) >> 6, (flags & 0x20) >> 5, (flags & 0x80) >> 7, (flags & 0x40) >> 6, (flags & 0x20) >> 5,
(flags & 0x10) >> 4, (flags & 0x8) >> 3, (flags & 0x4) >> 2, (flags & 0x10) >> 4, (flags & 0x8) >> 3, (flags & 0x4) >> 2,
(flags & 0x2) >> 1, (flags & 0x1) >> 0, (flags & 0x2) >> 1, (flags & 0x1) >> 0,
((double)TIMER_TOC(timer_dosort)) / CPU_TPS * 1000); clocks_from_ticks(TIMER_TOC(timer_dosort)));
fflush(stdout); fflush(stdout);
#else #else
if (clock) TIMER_TOC(timer_dosort); if (clock) TIMER_TOC(timer_dosort);
...@@ -478,7 +478,7 @@ void runner_dogsort(struct runner *r, struct cell *c, int flags, int clock) { ...@@ -478,7 +478,7 @@ void runner_dogsort(struct runner *r, struct cell *c, int flags, int clock) {
(flags & 0x80) >> 7, (flags & 0x40) >> 6, (flags & 0x20) >> 5, (flags & 0x80) >> 7, (flags & 0x40) >> 6, (flags & 0x20) >> 5,
(flags & 0x10) >> 4, (flags & 0x8) >> 3, (flags & 0x4) >> 2, (flags & 0x10) >> 4, (flags & 0x8) >> 3, (flags & 0x4) >> 2,
(flags & 0x2) >> 1, (flags & 0x1) >> 0, (flags & 0x2) >> 1, (flags & 0x1) >> 0,
((double)TIMER_TOC(timer_dosort)) / CPU_TPS * 1000); clocks_from_ticks(TIMER_TOC(timer_dosort)));
fflush(stdout); fflush(stdout);
#else #else
if (clock) TIMER_TOC(timer_dosort); if (clock) TIMER_TOC(timer_dosort);
...@@ -525,7 +525,7 @@ void runner_doinit(struct runner *r, struct cell *c, int timer) { ...@@ -525,7 +525,7 @@ void runner_doinit(struct runner *r, struct cell *c, int timer) {
if (timer) { if (timer) {
#ifdef TIMER_VERBOSE #ifdef TIMER_VERBOSE
message("runner %02i: %i parts at depth %i took %.3f ms.", r->id, c->count, 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); c->depth, clocks_from_ticks(TIMER_TOC(timer_init)));
fflush(stdout); fflush(stdout);
#else #else
TIMER_TOC(timer_init); TIMER_TOC(timer_init);
...@@ -681,7 +681,7 @@ void runner_doghost(struct runner *r, struct cell *c) { ...@@ -681,7 +681,7 @@ void runner_doghost(struct runner *r, struct cell *c) {
#ifdef TIMER_VERBOSE #ifdef TIMER_VERBOSE
message("runner %02i: %i parts at depth %i took %.3f ms.", r->id, c->count, message("runner %02i: %i parts at depth %i took %.3f ms.", r->id, c->count,
c->depth, ((double)TIMER_TOC(timer_doghost)) / CPU_TPS * 1000); c->depth, clocks_from_ticks(TIMER_TOC(timer_doghost)));
fflush(stdout); fflush(stdout);
#else #else
TIMER_TOC(timer_doghost); TIMER_TOC(timer_doghost);
...@@ -782,7 +782,7 @@ void runner_dodrift(struct runner *r, struct cell *c, int timer) { ...@@ -782,7 +782,7 @@ void runner_dodrift(struct runner *r, struct cell *c, int timer) {
if (timer) { if (timer) {
#ifdef TIMER_VERBOSE #ifdef TIMER_VERBOSE
message("runner %02i: %i parts at depth %i took %.3f ms.", r->id, c->count, message("runner %02i: %i parts at depth %i took %.3f ms.", r->id, c->count,
c->depth, ((double)TIMER_TOC(timer_drift)) / CPU_TPS * 1000); c->depth, clocks_from_ticks(TIMER_TOC(timer_drift)));
fflush(stdout); fflush(stdout);
#else #else
TIMER_TOC(timer_drift); TIMER_TOC(timer_drift);
...@@ -994,7 +994,7 @@ void runner_dokick(struct runner *r, struct cell *c, int timer) { ...@@ -994,7 +994,7 @@ void runner_dokick(struct runner *r, struct cell *c, int timer) {
if (timer) { if (timer) {
#ifdef TIMER_VERBOSE #ifdef TIMER_VERBOSE
message("runner %02i: %i parts at depth %i took %.3f ms.", r->id, c->count, message("runner %02i: %i parts at depth %i took %.3f ms.", r->id, c->count,
c->depth, ((double)TIMER_TOC(timer_kick)) / CPU_TPS * 1000); c->depth, clocks_from_ticks(TIMER_TOC(timer_kick)));
fflush(stdout); fflush(stdout);
#else #else
TIMER_TOC(timer_kick); TIMER_TOC(timer_kick);
......
...@@ -207,7 +207,7 @@ void DOPAIR_NAIVE(struct runner *r, struct cell *restrict ci, ...@@ -207,7 +207,7 @@ void DOPAIR_NAIVE(struct runner *r, struct cell *restrict ci,
"runner_dopair_naive[%02i]: %i/%i parts at depth %i (r_max=%.3f/%.3f) " "runner_dopair_naive[%02i]: %i/%i parts at depth %i (r_max=%.3f/%.3f) "
"took %.3f ms.\n", "took %.3f ms.\n",
r->id, count_i, count_j, ci->depth, ci->h_max, cj->h_max, r->id, count_i, count_j, ci->depth, ci->h_max, cj->h_max,
((double)TIMER_TOC(TIMER_DOPAIR)) / CPU_TPS * 1000); clocks_from_ticks(TIMER_TOC(TIMER_DOPAIR)));
#else #else
TIMER_TOC(TIMER_DOPAIR); TIMER_TOC(TIMER_DOPAIR);
#endif #endif
...@@ -307,7 +307,7 @@ void DOSELF_NAIVE(struct runner *r, struct cell *restrict c) { ...@@ -307,7 +307,7 @@ void DOSELF_NAIVE(struct runner *r, struct cell *restrict c) {
#ifdef TIMER_VERBOSE #ifdef TIMER_VERBOSE
printf("runner_doself[%02i]: %i parts at depth %i took %.3f ms.\n", r->id, printf("runner_doself[%02i]: %i parts at depth %i took %.3f ms.\n", r->id,
count, c->depth, ((double)TIMER_TOC(TIMER_DOSELF)) / CPU_TPS * 1000); count, c->depth, clocks_from_ticks(TIMER_TOC(TIMER_DOSELF)));
#else #else
TIMER_TOC(TIMER_DOSELF); TIMER_TOC(TIMER_DOSELF);
#endif #endif
...@@ -515,7 +515,7 @@ void DOPAIR_SUBSET(struct runner *r, struct cell *restrict ci, ...@@ -515,7 +515,7 @@ void DOPAIR_SUBSET(struct runner *r, struct cell *restrict ci,
"runner_dopair_subset[%02i]: %i/%i parts at depth %i (r_max=%.3f/%.3f) " "runner_dopair_subset[%02i]: %i/%i parts at depth %i (r_max=%.3f/%.3f) "
"took %.3f ms.\n", "took %.3f ms.\n",
r->id, count, count_j, ci->depth, ci->h_max, cj->h_max, r->id, count, count_j, ci->depth, ci->h_max, cj->h_max,
((double)TIMER_TOC(TIMER_DOPAIR)) / CPU_TPS * 1000); clocks_from_ticks(TIMER_TOC(TIMER_DOPAIR)));
#else #else
TIMER_TOC(timer_dopair_subset); TIMER_TOC(timer_dopair_subset);
#endif #endif
...@@ -635,7 +635,7 @@ void DOPAIR_SUBSET_NAIVE(struct runner *r, struct cell *restrict ci, ...@@ -635,7 +635,7 @@ void DOPAIR_SUBSET_NAIVE(struct runner *r, struct cell *restrict ci,
"runner_dopair_subset[%02i]: %i/%i parts at depth %i (r_max=%.3f/%.3f) " "runner_dopair_subset[%02i]: %i/%i parts at depth %i (r_max=%.3f/%.3f) "
"took %.3f ms.\n", "took %.3f ms.\n",
r->id, count, count_j, ci->depth, ci->h_max, cj->h_max, r->id, count, count_j, ci->depth, ci->h_max, cj->h_max,
((double)TIMER_TOC(TIMER_DOPAIR)) / CPU_TPS * 1000); clocks_from_ticks(TIMER_TOC(TIMER_DOPAIR)));
#else #else
TIMER_TOC(timer_dopair_subset); TIMER_TOC(timer_dopair_subset);
#endif #endif
...@@ -744,7 +744,7 @@ void DOSELF_SUBSET(struct runner *r, struct cell *restrict ci, ...@@ -744,7 +744,7 @@ void DOSELF_SUBSET(struct runner *r, struct cell *restrict ci,
#ifdef TIMER_VERBOSE #ifdef TIMER_VERBOSE
printf("runner_doself_subset[%02i]: %i/%i parts at depth %i took %.3f ms.\n", printf("runner_doself_subset[%02i]: %i/%i parts at depth %i took %.3f ms.\n",
r->id, count, ci->count, ci->depth, r->id, count, ci->count, ci->depth,
((double)TIMER_TOC(TIMER_DOSELF)) / CPU_TPS * 1000); clocks_from_ticks(TIMER_TOC(TIMER_DOSELF)));
#else #else
TIMER_TOC(timer_dopair_subset); TIMER_TOC(timer_dopair_subset);
#endif #endif
...@@ -871,7 +871,7 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj) { ...@@ -871,7 +871,7 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj) {
} /* loop over the parts in ci. */ } /* loop over the parts in ci. */
/* printf( "runner_dopair: first half took %.3f ms...\n" , /* printf( "runner_dopair: first half took %.3f ms...\n" ,
((double)(getticks() - tic)) / CPU_TPS * 1000 ); clocks_from_ticks(getticks() - tic));
tic = getticks(); */ tic = getticks(); */
/* Loop over the parts in cj. */ /* Loop over the parts in cj. */
...@@ -947,7 +947,7 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj) { ...@@ -947,7 +947,7 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj) {
"took %.3f ms.\n", "took %.3f ms.\n",
r->id, count_i, count_j, ci->depth, ci->h_max, cj->h_max, r->id, count_i, count_j, ci->depth, ci->h_max, cj->h_max,
fmax(ci->h[0], fmax(ci->h[1], ci->h[2])), fmax(ci->h[0], fmax(ci->h[1], ci->h[2])),
((double)(TIMER_TOC(TIMER_DOPAIR))) / CPU_TPS * 1000); clocks_from_ticks(TIMER_TOC(TIMER_DOPAIR)));
#else #else
TIMER_TOC(TIMER_DOPAIR); TIMER_TOC(TIMER_DOPAIR);
#endif #endif
...@@ -1183,7 +1183,7 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj) { ...@@ -1183,7 +1183,7 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj) {
} /* loop over the parts in ci. */ } /* loop over the parts in ci. */
/* printf( "runner_dopair: first half took %.3f ms...\n" , /* printf( "runner_dopair: first half took %.3f ms...\n" ,
((double)(getticks() - tic)) / CPU_TPS * 1000 ); clocks_from_ticks(getticks() - tic));
tic = getticks(); */ tic = getticks(); */
/* Loop over the parts in cj. */ /* Loop over the parts in cj. */
...@@ -1342,7 +1342,7 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj) { ...@@ -1342,7 +1342,7 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj) {
"took %.3f ms.\n", "took %.3f ms.\n",
r->id, count_i, count_j, ci->depth, ci->h_max, cj->h_max, r->id, count_i, count_j, ci->depth, ci->h_max, cj->h_max,
fmax(ci->h[0], fmax(ci->h[1], ci->h[2])), fmax(ci->h[0], fmax(ci->h[1], ci->h[2])),
((double)(TIMER_TOC(TIMER_DOPAIR))) / CPU_TPS * 1000); clocks_from_ticks(TIMER_TOC(TIMER_DOPAIR)));
#else #else
TIMER_TOC(TIMER_DOPAIR); TIMER_TOC(TIMER_DOPAIR);
#endif #endif
...@@ -1572,7 +1572,7 @@ void DOSELF1(struct runner *r, struct cell *restrict c) { ...@@ -1572,7 +1572,7 @@ void DOSELF1(struct runner *r, struct cell *restrict c) {
#ifdef TIMER_VERBOSE #ifdef TIMER_VERBOSE
printf("runner_doself1[%02i]: %i parts at depth %i took %.3f ms.\n", r->id, printf("runner_doself1[%02i]: %i parts at depth %i took %.3f ms.\n", r->id,
count, c->depth, ((double)TIMER_TOC(TIMER_DOSELF)) / CPU_TPS * 1000); count, c->depth, clocks_from_ticks(TIMER_TOC(TIMER_DOSELF)));
#else #else
TIMER_TOC(TIMER_DOSELF); TIMER_TOC(TIMER_DOSELF);
#endif #endif
...@@ -1769,7 +1769,7 @@ void DOSELF2(struct runner *r, struct cell *restrict c) { ...@@ -1769,7 +1769,7 @@ void DOSELF2(struct runner *r, struct cell *restrict c) {
#ifdef TIMER_VERBOSE #ifdef TIMER_VERBOSE
printf("runner_doself2[%02i]: %i parts at depth %i took %.3f ms.\n", r->id, printf("runner_doself2[%02i]: %i parts at depth %i took %.3f ms.\n", r->id,
count, c->depth, ((double)TIMER_TOC(TIMER_DOSELF)) / CPU_TPS * 1000); count, c->depth, clocks_from_ticks(TIMER_TOC(TIMER_DOSELF)));
#else #else
TIMER_TOC(TIMER_DOSELF); TIMER_TOC(TIMER_DOSELF);
#endif #endif
...@@ -2057,7 +2057,7 @@ void DOSUB1(struct runner *r, struct cell *ci, struct cell *cj, int sid, ...@@ -2057,7 +2057,7 @@ void DOSUB1(struct runner *r, struct cell *ci, struct cell *cj, int sid,
if (gettimer) if (gettimer)
#ifdef TIMER_VERBOSE #ifdef TIMER_VERBOSE
printf("runner_dosub1[%02i]: flags=%i at depth %i took %.3f ms.\n", r->id, printf("runner_dosub1[%02i]: flags=%i at depth %i took %.3f ms.\n", r->id,
sid, ci->depth, ((double)TIMER_TOC(TIMER_DOSUB)) / CPU_TPS * 1000); sid, ci->depth, clocks_from_ticks(TIMER_TOC(TIMER_DOSUB)));
#else #else
TIMER_TOC(TIMER_DOSUB); TIMER_TOC(TIMER_DOSUB);
#endif #endif
...@@ -2332,7 +2332,7 @@ void DOSUB2(struct runner *r, struct cell *ci, struct cell *cj, int sid, ...@@ -2332,7 +2332,7 @@ void DOSUB2(struct runner *r, struct cell *ci, struct cell *cj, int sid,
if (gettimer) if (gettimer)
#ifdef TIMER_VERBOSE #ifdef TIMER_VERBOSE
printf("runner_dosub2[%02i]: flags=%i at depth %i took %.3f ms.\n", r->id, printf("runner_dosub2[%02i]: flags=%i at depth %i took %.3f ms.\n", r->id,
sid, ci->depth, ((double)TIMER_TOC(TIMER_DOSUB)) / CPU_TPS * 1000); sid, ci->depth, clocks_from_ticks(TIMER_TOC(TIMER_DOSUB)));
#else #else
TIMER_TOC(TIMER_DOSUB); TIMER_TOC(TIMER_DOSUB);
#endif #endif
...@@ -2936,7 +2936,7 @@ void DOSUB_SUBSET(struct runner *r, struct cell *ci, struct part *parts, ...@@ -2936,7 +2936,7 @@ void DOSUB_SUBSET(struct runner *r, struct cell *ci, struct part *parts,
if (gettimer) if (gettimer)
#ifdef TIMER_VERBOSE #ifdef TIMER_VERBOSE
printf("runner_dosub[%02i]: flags=%i at depth %i took %.3f ms.\n", r->id, printf("runner_dosub[%02i]: flags=%i at depth %i took %.3f ms.\n", r->id,
sid, ci->depth, ((double)TIMER_TOC(TIMER_DOSUB)) / CPU_TPS * 1000); sid, ci->depth, clocks_from_ticks(TIMER_TOC(TIMER_DOSUB)));
#else #else
TIMER_TOC(TIMER_DOSUB); TIMER_TOC(TIMER_DOSUB);
#endif #endif
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
/* Includes. */ /* Includes. */
#include "cell.h" #include "cell.h"
#include "clocks.h"
#include "part.h" #include "part.h"
/** /**
...@@ -198,7 +199,7 @@ void runner_dopair_grav_new(struct runner *r, struct cell *ci, ...@@ -198,7 +199,7 @@ void runner_dopair_grav_new(struct runner *r, struct cell *ci,
"took %.3f ms.\n", "took %.3f ms.\n",
r->id, count_i, count_j, ci->depth, ci->h_max, cj->h_max, r->id, count_i, count_j, ci->depth, ci->h_max, cj->h_max,
fmax(ci->h[0], fmax(ci->h[1], ci->h[2])), fmax(ci->h[0], fmax(ci->h[1], ci->h[2])),
((double)(TIMER_TOC(TIMER_DOPAIR))) / CPU_TPS * 1000); clocks_from_ticks(TIMER_TOC(TIMER_DOPAIR)));
#else #else
TIMER_TOC(TIMER_DOPAIR); TIMER_TOC(TIMER_DOPAIR);
#endif #endif
...@@ -434,7 +435,7 @@ void runner_dopair_grav(struct runner *r, struct cell *restrict ci, ...@@ -434,7 +435,7 @@ void runner_dopair_grav(struct runner *r, struct cell *restrict ci,
"runner_dopair_naive_grav[%02i]: %i/%i parts at depth %i " "runner_dopair_naive_grav[%02i]: %i/%i parts at depth %i "
"(r_max=%.3f/%.3f) took %.3f ms.\n", "(r_max=%.3f/%.3f) took %.3f ms.\n",
r->id, count_i, count_j, ci->depth, ci->h_max, cj->h_max, r->id, count_i, count_j, ci->depth, ci->h_max, cj->h_max,
((double)TIMER_TOC(TIMER_DOPAIR)) / CPU_TPS * 1000); clocks_from_ticks(TIMER_TOC(TIMER_DOPAIR)));
#else #else
TIMER_TOC(timer_dopair_grav); TIMER_TOC(timer_dopair_grav);
#endif #endif
...@@ -530,7 +531,7 @@ void runner_doself_grav(struct runner *r, struct cell *restrict c) { ...@@ -530,7 +531,7 @@ void runner_doself_grav(struct runner *r, struct cell *restrict c) {
"runner_doself_grav[%02i]: %i/%i parts at depth %i (r_max=%.3f/%.3f) " "runner_doself_grav[%02i]: %i/%i parts at depth %i (r_max=%.3f/%.3f) "
"took %.3f ms.\n", "took %.3f ms.\n",
r->id, count_i, count_j, ci->depth, ci->h_max, cj->h_max, r->id, count_i, count_j, ci->depth, ci->h_max, cj->h_max,
((double)TIMER_TOC(TIMER_DOPAIR)) / CPU_TPS * 1000); clocks_from_ticks(TIMER_TOC(TIMER_DOPAIR)));
#else #else
TIMER_TOC(timer_doself_grav); TIMER_TOC(timer_doself_grav);
#endif #endif
...@@ -619,7 +620,7 @@ void runner_dosub_grav(struct runner *r, struct cell *ci, struct cell *cj, ...@@ -619,7 +620,7 @@ void runner_dosub_grav(struct runner *r, struct cell *ci, struct cell *cj,
if (gettimer) if (gettimer)
#ifdef TIMER_VERBOSE #ifdef TIMER_VERBOSE
printf("runner_dosub_grav[%02i]: at depth %i took %.3f ms.\n", r->id, printf("runner_dosub_grav[%02i]: at depth %i took %.3f ms.\n", r->id,
ci->depth, ((double)TIMER_TOC(TIMER_DOSUB)) / CPU_TPS * 1000); ci->depth, clocks_from_ticks(TIMER_TOC(TIMER_DOSUB)));
#else #else
TIMER_TOC(timer_dosub_grav); TIMER_TOC(timer_dosub_grav);
#endif #endif
......
...@@ -936,8 +936,8 @@ void scheduler_reweight(struct scheduler *s) { ...@@ -936,8 +936,8 @@ void scheduler_reweight(struct scheduler *s) {
if (t->type == task_type_send) t->weight = INT_MAX / 8; if (t->type == task_type_send) t->weight = INT_MAX / 8;
if (t->type == task_type_recv) t->weight *= 1.41; if (t->type == task_type_recv) t->weight *= 1.41;
} }
// message( "weighting tasks took %.3f ms." , (double)( getticks() - tic ) / // message( "weighting tasks took %.3f ms." ,
// CPU_TPS * 1000 ); //clocks_from_ticks( getticks() - tic ));
/* int min = tasks[0].weight, max = tasks[0].weight; /* int min = tasks[0].weight, max = tasks[0].weight;
for ( k = 1 ; k < nr_tasks ; k++ ) for ( k = 1 ; k < nr_tasks ; k++ )
...@@ -973,8 +973,8 @@ void scheduler_start(struct scheduler *s, unsigned int mask, ...@@ -973,8 +973,8 @@ void scheduler_start(struct scheduler *s, unsigned int mask,
s->tasks[k].wait = 1; s->tasks[k].wait = 1;
s->tasks[k].rid = -1; s->tasks[k].rid = -1;
} }
// message( "waiting tasks took %.3f ms." , (double)( getticks() - tic ) / // message( "waiting tasks took %.3f ms." ,
// CPU_TPS * 1000 ); //clocks_from_ticks( getticks() - tic ) );
/* Enqueue a set of extraenous tasks to set the task waits. */ /* Enqueue a set of extraenous tasks to set the task waits. */
struct task *rewait_tasks = &s->tasks[s->nr_tasks]; struct task *rewait_tasks = &s->tasks[s->nr_tasks];
...@@ -1017,7 +1017,7 @@ void scheduler_start(struct scheduler *s, unsigned int mask, ...@@ -1017,7 +1017,7 @@ void scheduler_start(struct scheduler *s, unsigned int mask,
} }
pthread_mutex_unlock(&s->sleep_mutex); pthread_mutex_unlock(&s->sleep_mutex);
/* message("waiting tasks took %.3f ms.", /* message("waiting tasks took %.3f ms.",
(double)(getticks() - tic) / CPU_TPS * 1000); */ clocks_from_ticks(getticks() - tic));*/
s->mask = mask; s->mask = mask;
s->submask = submask | (1 << task_subtype_none); s->submask = submask | (1 << task_subtype_none);
...@@ -1033,8 +1033,8 @@ void scheduler_start(struct scheduler *s, unsigned int mask, ...@@ -1033,8 +1033,8 @@ void scheduler_start(struct scheduler *s, unsigned int mask,
} }
} }
// message( "enqueueing tasks took %.3f ms." , (double)( getticks() - tic ) / // message( "enqueueing tasks took %.3f ms." ,
// CPU_TPS * 1000 ); //clocks_from_ticks( getticks() - tic ));
} }
/** /**
......
...@@ -264,8 +264,8 @@ void space_regrid(struct space *s, double cell_max, int verbose) { ...@@ -264,8 +264,8 @@ void space_regrid(struct space *s, double cell_max, int verbose) {
fflush(stdout); fflush(stdout);
} /* re-build upper-level cells? */ } /* re-build upper-level cells? */
// message( "rebuilding upper-level cells took %.3f ms." , (double)(getticks() // message( "rebuilding upper-level cells took %.3f ms." ,
// - tic) / CPU_TPS * 1000 ); // clocks_from_ticks(double)(getticks() - tic));
/* Otherwise, just clean up the cells. */ /* Otherwise, just clean up the cells. */
else { else {
...@@ -343,8 +343,8 @@ void space_rebuild(struct space *s, double cell_max, int verbose) { ...@@ -343,8 +343,8 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
cell_getid(cdim, p->x[0] * ih[0], p->x[1] * ih[1], p->x[2] * ih[2]); cell_getid(cdim, p->x[0] * ih[0], p->x[1] * ih[1], p->x[2] * ih[2]);
cells[ind[k]].count++; cells[ind[k]].count++;
} }
// message( "getting particle indices took %.3f ms." , (double)(getticks() - // message( "getting particle indices took %.3f ms." ,
// tic) / CPU_TPS * 1000 ); //clocks_from_ticks(getticks() - tic)):
#ifdef WITH_MPI #ifdef WITH_MPI
/* Move non-local parts to the end of the list. */ /* Move non-local parts to the end of the list. */
...@@ -396,8 +396,8 @@ void space_rebuild(struct space *s, double cell_max, int verbose) { ...@@ -396,8 +396,8 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
/* Sort the parts according to their cells. */ /* Sort the parts according to their cells. */
// tic = getticks(); // tic = getticks();
space_parts_sort(s, ind, nr_parts, 0, s->nr_cells - 1); space_parts_sort(s, ind, nr_parts, 0, s->nr_cells - 1);
// message( "parts_sort took %.3f ms." , (double)(getticks() - tic) / CPU_TPS // message( "parts_sort took %.3f ms." ,
// * 1000 ); //clocks_from_ticks(getticks() - tic));
/* Re-link the gparts. */ /* Re-link the gparts. */
for (k = 0; k < nr_parts; k++) for (k = 0; k < nr_parts; k++)
...@@ -431,16 +431,16 @@ void space_rebuild(struct space *s, double cell_max, int verbose) { ...@@ -431,16 +431,16 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
cell_getid(cdim, gp->x[0] * ih[0], gp->x[1] * ih[1], gp->x[2] * ih[2]); cell_getid(cdim, gp->x[0] * ih[0], gp->x[1] * ih[1], gp->x[2] * ih[2]);
cells[ind[k]].gcount++; cells[ind[k]].gcount++;
} }
// message( "getting particle indices took %.3f ms." , (double)(getticks() - // message( "getting particle indices took %.3f ms." ,
// tic) / CPU_TPS * 1000 ); //clocks_from_ticks(getticks() - tic));
/* TODO: Here we should exchange the gparts as well! */ /* TODO: Here we should exchange the gparts as well! */
/* Sort the parts according to their cells. */ /* Sort the parts according to their cells. */
// tic = getticks(); // tic = getticks();
gparts_sort(s->gparts, ind, nr_gparts, 0, s->nr_cells - 1); gparts_sort(s->gparts, ind, nr_gparts, 0, s->nr_cells - 1);
// message( "gparts_sort took %.3f ms." , (double)(getticks() - tic) / CPU_TPS // message( "gparts_sort took %.3f ms." ,
// * 1000 ); //clocks_from_ticks(getticks() - tic));
/* Re-link the parts. */ /* Re-link the parts. */
for (k = 0; k < nr_gparts; k++) for (k = 0; k < nr_gparts; k++)
...@@ -463,8 +463,8 @@ void space_rebuild(struct space *s, double cell_max, int verbose) { ...@@ -463,8 +463,8 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
xfinger = &xfinger[c->count]; xfinger = &xfinger[c->count];
gfinger = &gfinger[c->gcount]; gfinger = &gfinger[c->gcount];
} }