File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -28,25 +28,22 @@ extern "C" {
28
28
#endif
29
29
30
30
OPAL_DECLSPEC extern opal_timer_t opal_timer_windows_freq ;
31
+ OPAL_DECLSPEC extern opal_timer_t opal_timer_windows_start ;
31
32
32
33
static inline opal_timer_t
33
34
opal_timer_base_get_cycles (void )
34
35
{
35
36
LARGE_INTEGER now ;
36
37
QueryPerformanceCounter ( & now );
37
- return now .QuadPart ;
38
+ return ( now .QuadPart - opal_timer_windows_start ) ;
38
39
}
39
40
40
41
41
42
static inline opal_timer_t
42
43
opal_timer_base_get_usec (void )
43
44
{
44
- #if OPAL_HAVE_SYS_TIMER_GET_CYCLES
45
45
/* freq is in Hz, so this gives usec */
46
46
return opal_sys_timer_get_cycles () * 1000000 / opal_timer_windows_freq ;
47
- #else
48
- return 0 ;
49
- #endif
50
47
}
51
48
52
49
Original file line number Diff line number Diff line change 23
23
#include "opal/constants.h"
24
24
25
25
opal_timer_t opal_timer_windows_freq ;
26
+ opal_timer_t opal_timer_windows_start ;
26
27
27
28
static int opal_timer_windows_open (void );
28
29
@@ -58,8 +59,11 @@ opal_timer_windows_open(void)
58
59
{
59
60
LARGE_INTEGER now ;
60
61
61
- QueryPerformanceFrequency ( & now );
62
- opal_timer_windows_freq = now .QuadPart ;
63
-
62
+ if ( 0 != QueryPerformanceFrequency ( & now ) ) {
63
+ opal_timer_windows_freq = now .QuadPart ;
64
+ QueryPerformanceCounter ( & now );
65
+ opal_timer_windows_start = now .QuadPart ;
66
+ return OPAL_SUCCESS ;
67
+ }
64
68
return OPAL_SUCCESS ;
65
69
}
You can’t perform that action at this time.
0 commit comments