Adding high performance timers for windows (the same as for Linux we use the counters from
the processor). This commit was SVN r8458.
Этот коммит содержится в:
родитель
ebbac05f3c
Коммит
436ef18ec2
28
opal/mca/timer/windows/Makefile.am
Обычный файл
28
opal/mca/timer/windows/Makefile.am
Обычный файл
@ -0,0 +1,28 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||||
|
# University Research and Technology
|
||||||
|
# Corporation. All rights reserved.
|
||||||
|
# Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||||
|
# of Tennessee Research Foundation. All rights
|
||||||
|
# reserved.
|
||||||
|
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||||
|
# University of Stuttgart. All rights reserved.
|
||||||
|
# Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
|
# All rights reserved.
|
||||||
|
# $COPYRIGHT$
|
||||||
|
#
|
||||||
|
# Additional copyrights may follow
|
||||||
|
#
|
||||||
|
# $HEADER$
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
noinst_LTLIBRARIES = libmca_timer_windows.la
|
||||||
|
|
||||||
|
libmca_timer_windows_la_SOURCES = \
|
||||||
|
timer_windows.h \
|
||||||
|
timer_windows_component.c
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
$(doc_DATA)
|
58
opal/mca/timer/windows/configure.m4
Обычный файл
58
opal/mca/timer/windows/configure.m4
Обычный файл
@ -0,0 +1,58 @@
|
|||||||
|
# -*- shell-script -*-
|
||||||
|
#
|
||||||
|
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||||
|
# University Research and Technology
|
||||||
|
# Corporation. All rights reserved.
|
||||||
|
# Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||||
|
# of Tennessee Research Foundation. All rights
|
||||||
|
# reserved.
|
||||||
|
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||||
|
# University of Stuttgart. All rights reserved.
|
||||||
|
# Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
|
# All rights reserved.
|
||||||
|
# $COPYRIGHT$
|
||||||
|
#
|
||||||
|
# Additional copyrights may follow
|
||||||
|
#
|
||||||
|
# $HEADER$
|
||||||
|
#
|
||||||
|
|
||||||
|
AC_DEFUN([MCA_timer_windows_COMPILE_MODE], [
|
||||||
|
AC_MSG_CHECKING([for MCA component $2:$3 compile mode])
|
||||||
|
$4="static"
|
||||||
|
AC_MSG_RESULT([$$4])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# MCA_timer_windows_CONFIG(action-if-can-compile,
|
||||||
|
# [action-if-cant-compile])
|
||||||
|
# ------------------------------------------------
|
||||||
|
AC_DEFUN([MCA_timer_windows_CONFIG],[
|
||||||
|
AC_ARG_WITH([timer],
|
||||||
|
[AC_HELP_STRING([--with-timer=TYPE],
|
||||||
|
[Build high resolution timer component TYPE])])
|
||||||
|
|
||||||
|
AS_IF([test "$with_timer" = "windows"],
|
||||||
|
[timer_windows_happy="yes"
|
||||||
|
timer_windows_should_use=1],
|
||||||
|
[timer_windows_should_use=0
|
||||||
|
AS_IF([test "$with_timer" = ""],
|
||||||
|
[timer_windows_happy="yes"],
|
||||||
|
[timer_windows_happy="no"])])
|
||||||
|
|
||||||
|
AS_IF([test "$timer_windows_happy" = "yes"],
|
||||||
|
[AC_TRY_COMPILE([#include <windows.h>],
|
||||||
|
[LARGE_INTEGER now;
|
||||||
|
QueryPerformanceCounter( &now );],
|
||||||
|
[timer_windows_happy="yes"],
|
||||||
|
[timer_windows_happy="no"])])
|
||||||
|
|
||||||
|
AS_IF([test "$timer_windows_happy" = "no" -a \
|
||||||
|
"$timer_windows_should_use" = "1"],
|
||||||
|
[AC_MSG_ERROR([Windows timer requested but not available. Aborting.])])
|
||||||
|
|
||||||
|
AS_IF([test "$timer_windows_happy" = "yes"],
|
||||||
|
[timer_base_include="windows/timer_windows.h"
|
||||||
|
$1],
|
||||||
|
[$2])
|
||||||
|
])
|
23
opal/mca/timer/windows/configure.params
Обычный файл
23
opal/mca/timer/windows/configure.params
Обычный файл
@ -0,0 +1,23 @@
|
|||||||
|
# -*- shell-script -*-
|
||||||
|
#
|
||||||
|
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||||
|
# University Research and Technology
|
||||||
|
# Corporation. All rights reserved.
|
||||||
|
# Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||||
|
# of Tennessee Research Foundation. All rights
|
||||||
|
# reserved.
|
||||||
|
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||||
|
# University of Stuttgart. All rights reserved.
|
||||||
|
# Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
|
# All rights reserved.
|
||||||
|
# $COPYRIGHT$
|
||||||
|
#
|
||||||
|
# Additional copyrights may follow
|
||||||
|
#
|
||||||
|
# $HEADER$
|
||||||
|
#
|
||||||
|
|
||||||
|
# Specific to this module
|
||||||
|
|
||||||
|
PARAM_CONFIG_PRIORITY=10
|
||||||
|
PARAM_CONFIG_FILES="Makefile"
|
61
opal/mca/timer/windows/timer_windows.h
Обычный файл
61
opal/mca/timer/windows/timer_windows.h
Обычный файл
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||||
|
* University Research and Technology
|
||||||
|
* Corporation. All rights reserved.
|
||||||
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||||
|
* of Tennessee Research Foundation. All rights
|
||||||
|
* reserved.
|
||||||
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||||
|
* University of Stuttgart. All rights reserved.
|
||||||
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
|
* All rights reserved.
|
||||||
|
* $COPYRIGHT$
|
||||||
|
*
|
||||||
|
* Additional copyrights may follow
|
||||||
|
*
|
||||||
|
* $HEADER$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPAL_MCA_TIMER_WINDOWS_H
|
||||||
|
#define OPAL_MCA_TIMER_WINDOWS_H
|
||||||
|
|
||||||
|
#include "windows.h"
|
||||||
|
|
||||||
|
#include <opal/include/sys/timer.h>
|
||||||
|
|
||||||
|
OMPI_DECLSPEC opal_timer_t opal_timer_windows_freq;
|
||||||
|
|
||||||
|
static inline opal_timer_t
|
||||||
|
opal_timer_base_get_cycles(void)
|
||||||
|
{
|
||||||
|
LARGE_INTEGER now;
|
||||||
|
QueryPerformanceCounter( &now );
|
||||||
|
return (opal_timer_t)now;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline opal_timer_t
|
||||||
|
opal_timer_base_get_freq(void)
|
||||||
|
{
|
||||||
|
return opal_timer_windows_freq;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define OPAL_TIMER_CYCLE_NATIVE OPAL_HAVE_SYS_TIMER_GET_CYCLES
|
||||||
|
#define OPAL_TIMER_CYCLE_SUPPORTED OPAL_HAVE_SYS_TIMER_GET_CYCLES
|
||||||
|
#define OPAL_TIMER_USEC_NATIVE 0
|
||||||
|
#define OPAL_TIMER_USEC_SUPPORTED OPAL_HAVE_SYS_TIMER_GET_CYCLES
|
||||||
|
|
||||||
|
#endif
|
62
opal/mca/timer/windows/timer_windows_component.c
Обычный файл
62
opal/mca/timer/windows/timer_windows_component.c
Обычный файл
@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||||
|
* University Research and Technology
|
||||||
|
* Corporation. All rights reserved.
|
||||||
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||||
|
* of Tennessee Research Foundation. All rights
|
||||||
|
* reserved.
|
||||||
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||||
|
* University of Stuttgart. All rights reserved.
|
||||||
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
|
* All rights reserved.
|
||||||
|
* $COPYRIGHT$
|
||||||
|
*
|
||||||
|
* Additional copyrights may follow
|
||||||
|
*
|
||||||
|
* $HEADER$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ompi_config.h"
|
||||||
|
|
||||||
|
#include "opal/mca/timer/timer.h"
|
||||||
|
#include "opal/mca/timer/windows/timer_windows.h"
|
||||||
|
#include "opal/include/constants.h"
|
||||||
|
|
||||||
|
opal_timer_t opal_timer_windows_freq;
|
||||||
|
|
||||||
|
static int opal_timer_windows_open(void);
|
||||||
|
|
||||||
|
OMPI_DECLSPEC const
|
||||||
|
opal_timer_base_component_1_0_0_t mca_timer_windows_component = {
|
||||||
|
/* First, the mca_component_t struct containing meta information
|
||||||
|
about the component itself */
|
||||||
|
{
|
||||||
|
/* Indicate that we are a timer v1.0.0 component (which also
|
||||||
|
implies a specific MCA version) */
|
||||||
|
OPAL_TIMER_BASE_VERSION_1_0_0,
|
||||||
|
|
||||||
|
/* Component name and version */
|
||||||
|
"windows",
|
||||||
|
OPAL_MAJOR_VERSION,
|
||||||
|
OPAL_MINOR_VERSION,
|
||||||
|
OPAL_RELEASE_VERSION,
|
||||||
|
|
||||||
|
/* Component open and close functions */
|
||||||
|
opal_timer_windows_open,
|
||||||
|
NULL
|
||||||
|
},
|
||||||
|
|
||||||
|
/* Next the MCA v1.0.0 component meta data */
|
||||||
|
{
|
||||||
|
/* Whether the component is checkpointable or not */
|
||||||
|
true
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
int
|
||||||
|
opal_timer_windows_open(void)
|
||||||
|
{
|
||||||
|
QueryPerformanceFrequency( &opal_timer_windows_freq );
|
||||||
|
|
||||||
|
return OPAL_SUCCESS;
|
||||||
|
}
|
Загрузка…
Ссылка в новой задаче
Block a user