Skip to content

Commit 45dcf1f

Browse files
committed
Always use the best timer available
If we have better timer than clock_gettime use it, even if it an assembly timer.
1 parent 93fa94f commit 45dcf1f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

opal/mca/timer/linux/timer_linux_component.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@
3535
static opal_timer_t opal_timer_base_get_cycles_sys_timer(void);
3636
static opal_timer_t opal_timer_base_get_usec_sys_timer(void);
3737

38-
#if OPAL_HAVE_CLOCK_GETTIME
38+
#if OPAL_HAVE_CLOCK_GETTIME && (0 == OPAL_HAVE_SYS_TIMER_GET_CYCLES)
3939
static opal_timer_t opal_timer_base_get_cycles_clock_gettime(void);
4040
static opal_timer_t opal_timer_base_get_usec_clock_gettime(void);
4141
opal_timer_t (*opal_timer_base_get_cycles)(void) = opal_timer_base_get_cycles_clock_gettime;
4242
opal_timer_t (*opal_timer_base_get_usec)(void) = opal_timer_base_get_usec_clock_gettime;
4343
#else
4444
opal_timer_t (*opal_timer_base_get_cycles)(void) = opal_timer_base_get_cycles_sys_timer;
4545
opal_timer_t (*opal_timer_base_get_usec)(void) = opal_timer_base_get_usec_sys_timer;
46-
#endif /* OPAL_HAVE_CLOCK_GETTIME */
46+
#endif /* OPAL_HAVE_CLOCK_GETTIME && (0 == OPAL_HAVE_SYS_TIMER_GET_CYCLES) */
4747

4848
opal_timer_t opal_timer_linux_freq = {0};
4949

@@ -159,7 +159,7 @@ int opal_timer_linux_open(void)
159159
int ret = OPAL_SUCCESS;
160160

161161
if(mca_timer_base_monotonic) {
162-
#if OPAL_HAVE_CLOCK_GETTIME
162+
#if OPAL_HAVE_CLOCK_GETTIME && (0 == OPAL_HAVE_SYS_TIMER_GET_CYCLES)
163163
struct timespec res;
164164
if( 0 == clock_getres(CLOCK_MONOTONIC, &res)) {
165165
opal_timer_linux_freq = 1.e9;
@@ -172,15 +172,15 @@ int opal_timer_linux_open(void)
172172
/* Monotonic time requested but cannot be found. Complain! */
173173
opal_show_help("help-opal-timer-linux.txt", "monotonic not supported", 1);
174174
#endif /* (0 == OPAL_TIMER_MONOTONIC) */
175-
#endif
175+
#endif /* OPAL_HAVE_CLOCK_GETTIME && (0 == OPAL_HAVE_SYS_TIMER_GET_CYCLES) */
176176
}
177177
ret = opal_timer_linux_find_freq();
178178
opal_timer_base_get_cycles = opal_timer_base_get_cycles_sys_timer;
179179
opal_timer_base_get_usec = opal_timer_base_get_usec_sys_timer;
180180
return ret;
181181
}
182182

183-
#if OPAL_HAVE_CLOCK_GETTIME
183+
#if OPAL_HAVE_CLOCK_GETTIME && (0 == OPAL_HAVE_SYS_TIMER_GET_CYCLES)
184184
opal_timer_t opal_timer_base_get_usec_clock_gettime(void)
185185
{
186186
struct timespec tp;
@@ -200,7 +200,7 @@ opal_timer_t opal_timer_base_get_cycles_clock_gettime(void)
200200
}
201201
return 0;
202202
}
203-
#endif /* OPAL_HAVE_CLOCK_GETTIME */
203+
#endif /* OPAL_HAVE_CLOCK_GETTIME && (0 == OPAL_HAVE_SYS_TIMER_GET_CYCLES) */
204204

205205
opal_timer_t opal_timer_base_get_cycles_sys_timer(void)
206206
{

0 commit comments

Comments
 (0)