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" {
2828#endif
2929
3030OPAL_DECLSPEC extern opal_timer_t opal_timer_windows_freq ;
31+ OPAL_DECLSPEC extern opal_timer_t opal_timer_windows_start ;
3132
3233static inline opal_timer_t
3334opal_timer_base_get_cycles (void )
3435{
3536 LARGE_INTEGER now ;
3637 QueryPerformanceCounter ( & now );
37- return now .QuadPart ;
38+ return ( now .QuadPart - opal_timer_windows_start ) ;
3839}
3940
4041
4142static inline opal_timer_t
4243opal_timer_base_get_usec (void )
4344{
44- #if OPAL_HAVE_SYS_TIMER_GET_CYCLES
4545 /* freq is in Hz, so this gives usec */
4646 return opal_sys_timer_get_cycles () * 1000000 / opal_timer_windows_freq ;
47- #else
48- return 0 ;
49- #endif
5047}
5148
5249
Original file line number Diff line number Diff line change 2323#include "opal/constants.h"
2424
2525opal_timer_t opal_timer_windows_freq ;
26+ opal_timer_t opal_timer_windows_start ;
2627
2728static int opal_timer_windows_open (void );
2829
@@ -58,8 +59,11 @@ opal_timer_windows_open(void)
5859{
5960 LARGE_INTEGER now ;
6061
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+ }
6468 return OPAL_SUCCESS ;
6569}
You can’t perform that action at this time.
0 commit comments