Use the OPAL timers toi report timers as accurately as possible.
This commit was SVN r11442.
Этот коммит содержится в:
родитель
a33f63da26
Коммит
ee75c45ec5
@ -22,6 +22,7 @@
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
#include MCA_timer_IMPLEMENTATION_HEADER
|
||||
#include "ompi/mpi/c/bindings.h"
|
||||
#include "ompi/runtime/mpiruntime.h"
|
||||
|
||||
@ -38,5 +39,12 @@ static const char FUNC_NAME[] = "MPI_Wtick";
|
||||
|
||||
double MPI_Wtick(void)
|
||||
{
|
||||
return (double)0.000001;
|
||||
#if OPAL_TIMER_USEC_NATIVE
|
||||
return 0.000001;
|
||||
#else
|
||||
if( (opal_timer_t)0 == opal_timer_base_get_freq() ) {
|
||||
opal_output( 0, "No timer frequency\n" );
|
||||
}
|
||||
return (double)opal_timer_base_get_freq();
|
||||
#endif /* OPAL_TIMER_USEC_NATIVE */
|
||||
}
|
||||
|
@ -22,6 +22,8 @@
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
#include MCA_timer_IMPLEMENTATION_HEADER
|
||||
#include "opal/prefetch.h"
|
||||
#include "ompi/mpi/c/bindings.h"
|
||||
#include "ompi/runtime/mpiruntime.h"
|
||||
|
||||
@ -38,10 +40,9 @@ static const char FUNC_NAME[] = "MPI_Wtime";
|
||||
|
||||
double MPI_Wtime(void)
|
||||
{
|
||||
struct timeval tv;
|
||||
double wtime;
|
||||
gettimeofday(&tv, NULL);
|
||||
wtime = tv.tv_sec;
|
||||
wtime += (double)tv.tv_usec / 1000000.0;
|
||||
return wtime;
|
||||
#if OPAL_TIMER_USEC_NATIVE
|
||||
return (double)opal_timer_base_get_usec();
|
||||
#else
|
||||
return (double)opal_timer_base_get_cycles();
|
||||
#endif /* OPAL_TIMER_USEC_NATIVE */
|
||||
}
|
Загрузка…
Ссылка в новой задаче
Block a user