3
3
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
4
4
* University Research and Technology
5
5
* Corporation. All rights reserved.
6
- * Copyright (c) 2004-2014 The University of Tennessee and The University
6
+ * Copyright (c) 2004-2016 The University of Tennessee and The University
7
7
* of Tennessee Research Foundation. All rights
8
8
* reserved.
9
9
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
31
31
#include "opal/mca/timer/base/base.h"
32
32
#include "opal/mca/timer/linux/timer_linux.h"
33
33
#include "opal/constants.h"
34
+ #include "opal/util/show_help.h"
34
35
35
36
static opal_timer_t opal_timer_base_get_cycles_sys_timer (void );
36
37
static opal_timer_t opal_timer_base_get_usec_sys_timer (void );
37
38
38
- #if OPAL_HAVE_CLOCK_GETTIME && (0 == OPAL_HAVE_SYS_TIMER_GET_CYCLES )
39
+ /**
40
+ * Define some sane defaults until we call the _init function.
41
+ */
42
+ #if OPAL_HAVE_CLOCK_GETTIME
39
43
static opal_timer_t opal_timer_base_get_cycles_clock_gettime (void );
40
44
static opal_timer_t opal_timer_base_get_usec_clock_gettime (void );
41
45
opal_timer_t (* opal_timer_base_get_cycles )(void ) = opal_timer_base_get_cycles_clock_gettime ;
42
46
opal_timer_t (* opal_timer_base_get_usec )(void ) = opal_timer_base_get_usec_clock_gettime ;
43
47
#else
44
48
opal_timer_t (* opal_timer_base_get_cycles )(void ) = opal_timer_base_get_cycles_sys_timer ;
45
49
opal_timer_t (* opal_timer_base_get_usec )(void ) = opal_timer_base_get_usec_sys_timer ;
46
- #endif /* OPAL_HAVE_CLOCK_GETTIME && (0 == OPAL_HAVE_SYS_TIMER_GET_CYCLES) */
50
+ #endif /* OPAL_HAVE_CLOCK_GETTIME */
47
51
48
52
opal_timer_t opal_timer_linux_freq = {0 };
49
53
@@ -159,7 +163,7 @@ int opal_timer_linux_open(void)
159
163
int ret = OPAL_SUCCESS ;
160
164
161
165
if (mca_timer_base_monotonic ) {
162
- #if OPAL_HAVE_CLOCK_GETTIME && (0 == OPAL_HAVE_SYS_TIMER_GET_CYCLES )
166
+ #if OPAL_HAVE_CLOCK_GETTIME && (0 == OPAL_TIMER_MONOTONIC )
163
167
struct timespec res ;
164
168
if ( 0 == clock_getres (CLOCK_MONOTONIC , & res )) {
165
169
opal_timer_linux_freq = 1.e9 ;
@@ -170,17 +174,17 @@ int opal_timer_linux_open(void)
170
174
#else
171
175
#if (0 == OPAL_TIMER_MONOTONIC )
172
176
/* Monotonic time requested but cannot be found. Complain! */
173
- opal_show_help ("help-opal-timer-linux.txt" , "monotonic not supported" , 1 );
177
+ opal_show_help ("help-opal-timer-linux.txt" , "monotonic not supported" , true );
174
178
#endif /* (0 == OPAL_TIMER_MONOTONIC) */
175
- #endif /* OPAL_HAVE_CLOCK_GETTIME && (0 == OPAL_HAVE_SYS_TIMER_GET_CYCLES ) */
179
+ #endif /* OPAL_HAVE_CLOCK_GETTIME && (0 == OPAL_TIMER_MONOTONIC ) */
176
180
}
177
181
ret = opal_timer_linux_find_freq ();
178
182
opal_timer_base_get_cycles = opal_timer_base_get_cycles_sys_timer ;
179
183
opal_timer_base_get_usec = opal_timer_base_get_usec_sys_timer ;
180
184
return ret ;
181
185
}
182
186
183
- #if OPAL_HAVE_CLOCK_GETTIME && ( 0 == OPAL_HAVE_SYS_TIMER_GET_CYCLES )
187
+ #if OPAL_HAVE_CLOCK_GETTIME
184
188
opal_timer_t opal_timer_base_get_usec_clock_gettime (void )
185
189
{
186
190
struct timespec tp ;
@@ -200,7 +204,7 @@ opal_timer_t opal_timer_base_get_cycles_clock_gettime(void)
200
204
}
201
205
return 0 ;
202
206
}
203
- #endif /* OPAL_HAVE_CLOCK_GETTIME && (0 == OPAL_HAVE_SYS_TIMER_GET_CYCLES) */
207
+ #endif /* OPAL_HAVE_CLOCK_GETTIME */
204
208
205
209
opal_timer_t opal_timer_base_get_cycles_sys_timer (void )
206
210
{
0 commit comments