/* xbt_os_time.c -- portable interface to time-related functions */
-/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-2020. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
* @brief This section describes many macros/functions that can serve as an OS abstraction.
*/
struct s_xbt_os_timer {
-#if HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME && defined (_POSIX_THREAD_CPUTIME)
struct timespec start;
struct timespec stop;
struct timespec elapse;
free(timer);
}
-double xbt_os_timer_elapsed(xbt_os_timer_t timer)
+double xbt_os_timer_elapsed(const_xbt_os_timer_t timer)
{
#if HAVE_POSIX_GETTIME && defined (_POSIX_THREAD_CPUTIME)
return ((double) timer->stop.tv_sec) - ((double) timer->start.tv_sec) + ((double) timer->elapse.tv_sec ) +
FILETIME creationTime, exitTime, kernelTime, userTime;
GetProcessTimes(h, &creationTime, &exitTime, &kernelTime, &userTime);
w32_times_to_timeval(&timer->start, &kernelTime, &userTime);
+#else
+# error The cpu timers of SimGrid do not seem to work on your platform.
#endif
}
FILETIME creationTime, exitTime, kernelTime, userTime;
GetProcessTimes(h, &creationTime, &exitTime, &kernelTime, &userTime);
w32_times_to_timeval(&timer->start, &kernelTime, &userTime);
+#else
+# error The cpu timers of SimGrid do not seem to work on your platform.
#endif
}
FILETIME creationTime, exitTime, kernelTime, userTime;
GetProcessTimes(h, &creationTime, &exitTime, &kernelTime, &userTime);
w32_times_to_timeval(&timer->stop, &kernelTime, &userTime);
+#else
+# error The cpu timers of SimGrid do not seem to work on your platform.
#endif
}
FILETIME creationTime, exitTime, kernelTime, userTime;
GetThreadTimes(h, &creationTime, &exitTime, &kernelTime, &userTime);
w32_times_to_timeval(&timer->start, &kernelTime, &userTime);
+#else
+# error The thread timers of SimGrid do not seem to work on your platform.
#endif
}
FILETIME creationTime, exitTime, kernelTime, userTime;
GetThreadTimes(h, &creationTime, &exitTime, &kernelTime, &userTime);
w32_times_to_timeval(&timer->start, &kernelTime, &userTime);
+#else
+# error The thread timers of SimGrid do not seem to work on your platform.
#endif
}
FILETIME creationTime, exitTime, kernelTime, userTime;
GetThreadTimes(h, &creationTime, &exitTime, &kernelTime, &userTime);
w32_times_to_timeval(&timer->stop, &kernelTime, &userTime);
+#else
+# error The thread timers of SimGrid do not seem to work on your platform.
#endif
}