On Windows use the high performance timers ... differently or lose
data in the conversion. This commit was SVN r11441.
Этот коммит содержится в:
родитель
0e317286f3
Коммит
a33f63da26
@ -28,25 +28,22 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
OPAL_DECLSPEC extern opal_timer_t opal_timer_windows_freq;
|
OPAL_DECLSPEC extern opal_timer_t opal_timer_windows_freq;
|
||||||
|
OPAL_DECLSPEC extern opal_timer_t opal_timer_windows_start;
|
||||||
|
|
||||||
static inline opal_timer_t
|
static inline opal_timer_t
|
||||||
opal_timer_base_get_cycles(void)
|
opal_timer_base_get_cycles(void)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER now;
|
LARGE_INTEGER now;
|
||||||
QueryPerformanceCounter( &now );
|
QueryPerformanceCounter( &now );
|
||||||
return now.QuadPart;
|
return (now.QuadPart - opal_timer_windows_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline opal_timer_t
|
static inline opal_timer_t
|
||||||
opal_timer_base_get_usec(void)
|
opal_timer_base_get_usec(void)
|
||||||
{
|
{
|
||||||
#if OPAL_HAVE_SYS_TIMER_GET_CYCLES
|
|
||||||
/* freq is in Hz, so this gives usec */
|
/* freq is in Hz, so this gives usec */
|
||||||
return opal_sys_timer_get_cycles() * 1000000 / opal_timer_windows_freq;
|
return opal_sys_timer_get_cycles() * 1000000 / opal_timer_windows_freq;
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "opal/constants.h"
|
#include "opal/constants.h"
|
||||||
|
|
||||||
opal_timer_t opal_timer_windows_freq;
|
opal_timer_t opal_timer_windows_freq;
|
||||||
|
opal_timer_t opal_timer_windows_start;
|
||||||
|
|
||||||
static int opal_timer_windows_open(void);
|
static int opal_timer_windows_open(void);
|
||||||
|
|
||||||
@ -58,8 +59,11 @@ opal_timer_windows_open(void)
|
|||||||
{
|
{
|
||||||
LARGE_INTEGER now;
|
LARGE_INTEGER now;
|
||||||
|
|
||||||
QueryPerformanceFrequency( &now );
|
if( 0 != QueryPerformanceFrequency( &now ) ) {
|
||||||
opal_timer_windows_freq = now.QuadPart;
|
opal_timer_windows_freq = now.QuadPart;
|
||||||
|
QueryPerformanceCounter( &now );
|
||||||
|
opal_timer_windows_start = now.QuadPart;
|
||||||
|
return OPAL_SUCCESS;
|
||||||
|
}
|
||||||
return OPAL_SUCCESS;
|
return OPAL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user