Commit 912f28d4 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Better name for the time-stamp function

parent 1a2e49aa
......@@ -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];
......
......@@ -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 */
......@@ -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");
......
......@@ -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
......
Supports Markdown
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