6 XBT_LOG_NEW_DEFAULT_CATEGORY(MM_timer,
7 "Messages specific for this msg example");
9 /* this could be specific for some processors
10 * the default solution seems to be accurate enough
11 #define CLOCK_TIMER CLOCK_MONOTONIC_RAW
14 inline double get_microsecond(struct timespec *res){
15 return (res->tv_sec*1000000 + res->tv_nsec/1000);
17 inline double get_nanosecond(struct timespec *res){
18 return (res->tv_sec*1000000000 + res->tv_nsec);
20 inline double get_second(struct timespec *res){
21 return (res->tv_sec + res->tv_nsec/1000000000);
24 inline int get_time(struct timespec *tp){
25 double time = MPI_Wtime();
26 time_t value = (time_t)floor(time);
27 time -= (double) value;
28 time = time * 1000000000;
29 tp->tv_nsec = (long) time;
33 double get_timediff(struct timespec *start, struct timespec *end){
34 return (double)(-start->tv_sec - ((double)start->tv_nsec)/1000000000 + end->tv_sec + ((double)end->tv_nsec)/1000000000);