소스 검색

Use S4U's simgrid_get_clock when available

Samuel Thibault 5 년 전
부모
커밋
1e8a3523c6
2개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      configure.ac
  2. 7 0
      src/common/timing.c

+ 1 - 0
configure.ac

@@ -178,6 +178,7 @@ if test x$enable_simgrid = xyes ; then
 	AC_CHECK_HEADERS([xbt/synchro.h], [AC_DEFINE([STARPU_HAVE_XBT_SYNCHRO_H], [1], [Define to 1 if you have synchro.h in xbt/.])])
 	AC_CHECK_HEADERS([simgrid/actor.h], [AC_DEFINE([STARPU_HAVE_SIMGRID_ACTOR_H], [1], [Define to 1 if you have actor.h in simgrid/.])])
 	AC_CHECK_HEADERS([simgrid/semaphore.h], [AC_DEFINE([STARPU_HAVE_SIMGRID_SEMAPHORE_H], [1], [Define to 1 if you have semaphore.h in simgrid/.])])
+	AC_CHECK_HEADERS([simgrid/engine.h])
 	AC_CHECK_TYPES([smx_actor_t], [AC_DEFINE([STARPU_HAVE_SMX_ACTOR_T], [1], [Define to 1 if you have the smx_actor_t type.])], [], [[#include <simgrid/simix.h>]])
 
 	# Latest functions

+ 7 - 0
src/common/timing.c

@@ -24,6 +24,9 @@
 
 #ifdef STARPU_SIMGRID
 #include <core/simgrid.h>
+#ifdef HAVE_SIMGRID_ENGINE_H
+#include <simgrid/engine.h>
+#endif
 #endif
 
 #if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
@@ -37,7 +40,11 @@ void _starpu_timing_init(void)
 
 void _starpu_clock_gettime(struct timespec *ts)
 {
+#ifdef HAVE_SIMGRID_ENGINE_H
 	double now = MSG_get_clock();
+#else
+	double now = simgrid_get_clock();
+#endif
 	ts->tv_sec = floor(now);
 	ts->tv_nsec = floor((now - ts->tv_sec) * 1000000000);
 }