File tree Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change 22
22
#endif
23
23
#include <stdio.h>
24
24
25
+ #include MCA_timer_IMPLEMENTATION_HEADER
25
26
#include "ompi/mpi/c/bindings.h"
26
27
#include "ompi/runtime/mpiruntime.h"
27
28
@@ -38,5 +39,12 @@ static const char FUNC_NAME[] = "MPI_Wtick";
38
39
39
40
double MPI_Wtick (void )
40
41
{
41
- return (double )0.000001 ;
42
+ #if OPAL_TIMER_USEC_NATIVE
43
+ return 0.000001 ;
44
+ #else
45
+ if ( (opal_timer_t )0 == opal_timer_base_get_freq () ) {
46
+ opal_output ( 0 , "No timer frequency\n" );
47
+ }
48
+ return (double )opal_timer_base_get_freq ();
49
+ #endif /* OPAL_TIMER_USEC_NATIVE */
42
50
}
Original file line number Diff line number Diff line change 22
22
#endif
23
23
#include <stdio.h>
24
24
25
+ #include MCA_timer_IMPLEMENTATION_HEADER
26
+ #include "opal/prefetch.h"
25
27
#include "ompi/mpi/c/bindings.h"
26
28
#include "ompi/runtime/mpiruntime.h"
27
29
@@ -38,10 +40,9 @@ static const char FUNC_NAME[] = "MPI_Wtime";
38
40
39
41
double MPI_Wtime (void )
40
42
{
41
- struct timeval tv ;
42
- double wtime ;
43
- gettimeofday (& tv , NULL );
44
- wtime = tv .tv_sec ;
45
- wtime += (double )tv .tv_usec / 1000000.0 ;
46
- return wtime ;
47
- }
43
+ #if OPAL_TIMER_USEC_NATIVE
44
+ return (double )opal_timer_base_get_usec ();
45
+ #else
46
+ return (double )opal_timer_base_get_cycles ();
47
+ #endif /* OPAL_TIMER_USEC_NATIVE */
48
+ }
You can’t perform that action at this time.
0 commit comments