Skip to content

Commit 163bbd4

Browse files
authored
Merge pull request #6567 from kawashima-fj/pr/sys-timer-cleanup
opal/sys: Native timer cleanup
2 parents 0a446b0 + 77286a4 commit 163bbd4

File tree

6 files changed

+11
-14
lines changed

6 files changed

+11
-14
lines changed

opal/include/opal/sys/arm64/timer.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
#ifndef OPAL_SYS_ARCH_TIMER_H
1717
#define OPAL_SYS_ARCH_TIMER_H 1
1818

19-
#include <sys/times.h>
20-
2119
typedef uint64_t opal_timer_t;
2220

2321
static inline opal_timer_t
@@ -33,13 +31,14 @@ opal_sys_timer_get_cycles(void)
3331

3432

3533
static inline opal_timer_t
36-
opal_sys_timer_freq(void)
34+
opal_sys_timer_get_freq(void)
3735
{
3836
opal_timer_t freq;
3937
__asm__ __volatile__ ("mrs %0, CNTFRQ_EL0" : "=r" (freq));
4038
return (opal_timer_t)(freq);
4139
}
4240

4341
#define OPAL_HAVE_SYS_TIMER_GET_CYCLES 1
42+
#define OPAL_HAVE_SYS_TIMER_GET_FREQ 1
4443

4544
#endif /* ! OPAL_SYS_ARCH_TIMER_H */

opal/include/opal/sys/ia32/timer.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ opal_sys_timer_get_cycles(void)
4949

5050
#else
5151

52-
opal_timer_t opal_sys_timer_get_cycles(void);
53-
54-
#define OPAL_HAVE_SYS_TIMER_GET_CYCLES 1
52+
#define OPAL_HAVE_SYS_TIMER_GET_CYCLES 0
5553

5654
#endif /* OPAL_GCC_INLINE_ASSEMBLY */
5755

opal/include/opal/sys/powerpc/timer.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ opal_sys_timer_get_cycles(void)
4343

4444
#else
4545

46-
opal_timer_t opal_sys_timer_get_cycles(void);
47-
48-
#define OPAL_HAVE_SYS_TIMER_GET_CYCLES 1
46+
#define OPAL_HAVE_SYS_TIMER_GET_CYCLES 0
4947

5048
#endif /* OPAL_GCC_INLINE_ASSEMBLY */
5149

opal/include/opal/sys/timer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ BEGIN_C_DECLS
9898

9999
typedef long opal_timer_t;
100100
#endif
101+
102+
#ifndef OPAL_HAVE_SYS_TIMER_GET_FREQ
103+
#define OPAL_HAVE_SYS_TIMER_GET_FREQ 0
104+
#endif
101105
#endif
102106

103107
#ifndef OPAL_HAVE_SYS_TIMER_IS_MONOTONIC

opal/include/opal/sys/x86_64/timer.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ static inline bool opal_sys_timer_is_monotonic (void)
6565

6666
#else
6767

68-
opal_timer_t opal_sys_timer_get_cycles(void);
69-
70-
#define OPAL_HAVE_SYS_TIMER_GET_CYCLES 1
68+
#define OPAL_HAVE_SYS_TIMER_GET_CYCLES 0
7169

7270
#endif /* OPAL_GCC_INLINE_ASSEMBLY */
7371

opal/mca/timer/linux/timer_linux_component.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ static int opal_timer_linux_find_freq(void)
117117

118118
opal_timer_linux_freq = 0;
119119

120-
#if OPAL_ASSEMBLY_ARCH == OPAL_ARM64
121-
opal_timer_linux_freq = opal_sys_timer_freq();
120+
#if OPAL_HAVE_SYS_TIMER_GET_FREQ
121+
opal_timer_linux_freq = opal_sys_timer_get_freq();
122122
#endif
123123

124124
if (0 == opal_timer_linux_freq) {

0 commit comments

Comments
 (0)