1
1

On Windows use the high performance timers ... differently or lose

data in the conversion.

This commit was SVN r11441.
Этот коммит содержится в:
George Bosilca 2006-08-27 04:56:20 +00:00
родитель 0e317286f3
Коммит a33f63da26
2 изменённых файлов: 9 добавлений и 8 удалений

Просмотреть файл

@ -28,25 +28,22 @@ extern "C" {
#endif
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
opal_timer_base_get_cycles(void)
{
LARGE_INTEGER now;
QueryPerformanceCounter( &now );
return now.QuadPart;
return (now.QuadPart - opal_timer_windows_start);
}
static inline opal_timer_t
opal_timer_base_get_usec(void)
{
#if OPAL_HAVE_SYS_TIMER_GET_CYCLES
/* freq is in Hz, so this gives usec */
return opal_sys_timer_get_cycles() * 1000000 / opal_timer_windows_freq;
#else
return 0;
#endif
}

Просмотреть файл

@ -23,6 +23,7 @@
#include "opal/constants.h"
opal_timer_t opal_timer_windows_freq;
opal_timer_t opal_timer_windows_start;
static int opal_timer_windows_open(void);
@ -58,8 +59,11 @@ opal_timer_windows_open(void)
{
LARGE_INTEGER now;
QueryPerformanceFrequency( &now );
opal_timer_windows_freq = now.QuadPart;
if( 0 != QueryPerformanceFrequency( &now ) ) {
opal_timer_windows_freq = now.QuadPart;
QueryPerformanceCounter( &now );
opal_timer_windows_start = now.QuadPart;
return OPAL_SUCCESS;
}
return OPAL_SUCCESS;
}