* If/when any kind of task parallelism is implemented (even OpenMP
* regions simultaneously assigned to different tasks), consider
* whether this data structure (and/or cycle counters) should be
- * maintained on a per-OpenMP-thread basis. */
+ * maintained on a per-OpenMP-thread basis.
+ *
+ * Consider also replacing this with std::chrono. */
/*! \brief Manages caching wall-clock time measurements for
* simulations */
double
gmx_gettime()
{
-#if HAVE_CLOCK_GETTIME && _POSIX_TIMERS >= 0 && !(defined __bgq__ && defined __clang__)
- /* Mac and Windows do not support this. For added fun, Windows
- * defines _POSIX_TIMERS without actually providing the
- * implementation. The BlueGene/Q CNK only supports gettimeofday,
- * and bgclang doesn't provide a fully functional implementation
- * for clock_gettime (unlike xlc). */
+ /* Use clock_gettime only if we know linking the C run-time
+ library will work (which is not trivial on e.g. Crays), and its
+ headers claim sufficient support for POSIX (ie not Mac and
+ Windows), and it isn't BG/Q (whose compute node kernel only
+ supports gettimeofday, and bgclang doesn't provide a fully
+ functional implementation clock_gettime, unlike xlc). */
+#if HAVE_CLOCK_GETTIME && defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0 && !(defined __bgq__ && defined __clang__)
struct timespec t;
double seconds;
static double
gmx_gettime_per_thread()
{
-#if HAVE_CLOCK_GETTIME && _POSIX_THREAD_CPUTIME >= 0
+ /* Use clock_gettime only if we know linking the C run-time
+ library will work (which is not trivial on e.g. Crays), and its
+ headers claim sufficient support for POSIX (ie not Mac and
+ Windows), and it isn't BG/Q (whose compute node kernel only
+ supports gettimeofday, and bgclang doesn't provide a fully
+ functional implementation clock_gettime, unlike xlc). */
+#if HAVE_CLOCK_GETTIME && defined(_POSIX_THREAD_CPUTIME) && _POSIX_THREAD_CPUTIME > 0 && !(defined __bgq__ && defined __clang__)
struct timespec t;
double seconds;