diff --git a/src/clocks.c b/src/clocks.c index 843970edf8d0647b1c86071f7fa99844809a28d3..50a4c624122f60e5b26eb5eb075a7774c119fc5d 100644 --- a/src/clocks.c +++ b/src/clocks.c @@ -233,7 +233,7 @@ const char *clocks_getunit() { return clocks_units[clocks_units_index]; } * * @result the time since the start of the execution */ -const char *clocks_get_timeofday() { +const char *clocks_get_timesincestart() { static char buffer[40]; diff --git a/src/clocks.h b/src/clocks.h index 20ac6f954b4bc2cdeed04396b3a59bf381d34bc7..1b4640d605c5ff5d0d9a3d07af158e346695974e 100644 --- a/src/clocks.h +++ b/src/clocks.h @@ -39,6 +39,6 @@ void clocks_set_cpufreq(unsigned long long freq); unsigned long long clocks_get_cpufreq(); double clocks_from_ticks(ticks tics); double clocks_diff_ticks(ticks tic, ticks toc); -const char *clocks_get_timeofday(); +const char *clocks_get_timesincestart(); #endif /* SWIFT_CLOCKS_H */ diff --git a/src/engine.c b/src/engine.c index 04c9f3c03288b1e9e4134b76d45433c446fbfd3d..43df6c3b6a39ef0f3a76e202a351f52acecb8259 100644 --- a/src/engine.c +++ b/src/engine.c @@ -1171,10 +1171,10 @@ void engine_print(struct engine *e) { counts[task_type_count] += 1; #ifdef WITH_MPI printf("[%04i] %s engine_print: task counts are [ %s=%i", e->nodeID, - clocks_get_timeofday(), taskID_names[0], counts[0]); + clocks_get_timesincestart(), taskID_names[0], counts[0]); #else - printf("%s engine_print: task counts are [ %s=%i", clocks_get_timeofday(), - taskID_names[0], counts[0]); + printf("%s engine_print: task counts are [ %s=%i", + clocks_get_timesincestart(), taskID_names[0], counts[0]); #endif for (k = 1; k < task_type_count; k++) printf(" %s=%i", taskID_names[k], counts[k]); @@ -1929,9 +1929,9 @@ void engine_init(struct engine *e, struct space *s, float dt, int nr_threads, if (nodeID == 0) { #ifdef WITH_MPI printf("[%04i] %s engine_init: cpu map is [ ", nodeID, - clocks_get_timeofday()); + clocks_get_timesincestart()); #else - printf("%s engine_init: cpu map is [ ", clocks_get_timeofday()); + printf("%s engine_init: cpu map is [ ", clocks_get_timesincestart()); #endif for (int i = 0; i < nr_cores; i++) printf("%i ", cpuid[i]); printf("].\n"); @@ -2108,14 +2108,15 @@ void engine_print_policy(struct engine *e) { #ifdef WITH_MPI if (e->nodeID == 0) { printf("[0000] %s engine_policy: engine policies are [ ", - clocks_get_timeofday()); + clocks_get_timesincestart()); for (int k = 1; k < 32; k++) if (e->policy & (1 << k)) printf(" %s ", engine_policy_names[k + 1]); printf(" ]\n"); fflush(stdout); } #else - printf("%s engine_policy: engine policies are [ ", clocks_get_timeofday()); + printf("%s engine_policy: engine policies are [ ", + clocks_get_timesincestart()); for (int k = 1; k < 32; k++) if (e->policy & (1 << k)) printf(" %s ", engine_policy_names[k + 1]); printf(" ]\n"); diff --git a/src/error.h b/src/error.h index 4a6b931d49f5261394940ac79849a648c9ef9461..b131cb124feedc48e83427122f3a0edcb2ec81d4 100644 --- a/src/error.h +++ b/src/error.h @@ -37,19 +37,19 @@ */ #ifdef WITH_MPI extern int engine_rank; -#define error(s, ...) \ - { \ - fprintf(stderr, "[%04i] %s %s:%s():%i: " s "\n", engine_rank, \ - clocks_get_timeofday(), __FILE__, __FUNCTION__, __LINE__, \ - ##__VA_ARGS__); \ - MPI_Abort(MPI_COMM_WORLD, -1); \ +#define error(s, ...) \ + { \ + fprintf(stderr, "[%04i] %s %s:%s():%i: " s "\n", engine_rank, \ + clocks_get_timesincestart(), __FILE__, __FUNCTION__, __LINE__, \ + ##__VA_ARGS__); \ + MPI_Abort(MPI_COMM_WORLD, -1); \ } #else -#define error(s, ...) \ - { \ - fprintf(stderr, "%s %s:%s():%i: " s "\n", clocks_get_timeofday(), \ - __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__); \ - abort(); \ +#define error(s, ...) \ + { \ + fprintf(stderr, "%s %s:%s():%i: " s "\n", clocks_get_timesincestart(), \ + __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__); \ + abort(); \ } #endif @@ -59,27 +59,27 @@ extern int engine_rank; * followed by the MPI error string and aborts. * */ -#define mpi_error(res, s, ...) \ - { \ - fprintf(stderr, "[%04i] %s %s:%s():%i: " s "\n", engine_rank, \ - clocks_get_timeofday(), __FILE__, __FUNCTION__, __LINE__, \ - ##__VA_ARGS__); \ - int len = 1024; \ - char buf[len]; \ - MPI_Error_string(res, buf, &len); \ - fprintf(stderr, "%s\n\n", buf); \ - MPI_Abort(MPI_COMM_WORLD, -1); \ +#define mpi_error(res, s, ...) \ + { \ + fprintf(stderr, "[%04i] %s %s:%s():%i: " s "\n", engine_rank, \ + clocks_get_timesincestart(), __FILE__, __FUNCTION__, __LINE__, \ + ##__VA_ARGS__); \ + int len = 1024; \ + char buf[len]; \ + MPI_Error_string(res, buf, &len); \ + fprintf(stderr, "%s\n\n", buf); \ + MPI_Abort(MPI_COMM_WORLD, -1); \ } -#define mpi_error_string(res, s, ...) \ - { \ - fprintf(stderr, "[%04i] %s %s:%s():%i: " s "\n", engine_rank, \ - clocks_get_timeofday(), __FILE__, __FUNCTION__, __LINE__, \ - ##__VA_ARGS__); \ - int len = 1024; \ - char buf[len]; \ - MPI_Error_string(res, buf, &len); \ - fprintf(stderr, "%s\n\n", buf); \ +#define mpi_error_string(res, s, ...) \ + { \ + fprintf(stderr, "[%04i] %s %s:%s():%i: " s "\n", engine_rank, \ + clocks_get_timesincestart(), __FILE__, __FUNCTION__, __LINE__, \ + ##__VA_ARGS__); \ + int len = 1024; \ + char buf[len]; \ + MPI_Error_string(res, buf, &len); \ + fprintf(stderr, "%s\n\n", buf); \ } #endif @@ -89,12 +89,13 @@ extern int engine_rank; */ #ifdef WITH_MPI extern int engine_rank; -#define message(s, ...) \ - printf("[%04i] %s %s: " s "\n", engine_rank, clocks_get_timeofday(), \ +#define message(s, ...) \ + printf("[%04i] %s %s: " s "\n", engine_rank, clocks_get_timesincestart(), \ __FUNCTION__, ##__VA_ARGS__) #else -#define message(s, ...) \ - printf("%s %s: " s "\n", clocks_get_timeofday(), __FUNCTION__, ##__VA_ARGS__) +#define message(s, ...) \ + printf("%s %s: " s "\n", clocks_get_timesincestart(), __FUNCTION__, \ + ##__VA_ARGS__) #endif /** @@ -107,21 +108,21 @@ extern int engine_rank; { \ if (!(expr)) { \ fprintf(stderr, "[%04i] %s %s:%s():%i: FAILED ASSERTION: " #expr " \n", \ - engine_rank, clocks_get_timeofday(), __FILE__, __FUNCTION__, \ - __LINE__); \ + engine_rank, clocks_get_timesincestart(), __FILE__, \ + __FUNCTION__, __LINE__); \ fflush(stderr); \ MPI_Abort(MPI_COMM_WORLD, -1); \ } \ } #else -#define assert(expr) \ - { \ - if (!(expr)) { \ - fprintf(stderr, "%s %s:%s():%i: FAILED ASSERTION: " #expr " \n", \ - clocks_get_timeofday(), __FILE__, __FUNCTION__, __LINE__); \ - fflush(stderr); \ - abort(); \ - } \ +#define assert(expr) \ + { \ + if (!(expr)) { \ + fprintf(stderr, "%s %s:%s():%i: FAILED ASSERTION: " #expr " \n", \ + clocks_get_timesincestart(), __FILE__, __FUNCTION__, __LINE__); \ + fflush(stderr); \ + abort(); \ + } \ } #endif