Blame src/mpi/timer/wtime.c

Packit Service c5cf8c
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
Packit Service c5cf8c
/*
Packit Service c5cf8c
 *  (C) 2001 by Argonne National Laboratory.
Packit Service c5cf8c
 *      See COPYRIGHT in top-level directory.
Packit Service c5cf8c
 */
Packit Service c5cf8c
Packit Service c5cf8c
#include "mpiimpl.h"
Packit Service c5cf8c
/* -- Begin Profiling Symbol Block for routine MPI_Wtime */
Packit Service c5cf8c
#if defined(HAVE_PRAGMA_WEAK)
Packit Service c5cf8c
#pragma weak MPI_Wtime = PMPI_Wtime
Packit Service c5cf8c
#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
Packit Service c5cf8c
#pragma _HP_SECONDARY_DEF PMPI_Wtime  MPI_Wtime
Packit Service c5cf8c
#elif defined(HAVE_PRAGMA_CRI_DUP)
Packit Service c5cf8c
#pragma _CRI duplicate MPI_Wtime as PMPI_Wtime
Packit Service c5cf8c
#elif defined(HAVE_WEAK_ATTRIBUTE)
Packit Service c5cf8c
double MPI_Wtime(void) __attribute__ ((weak, alias("PMPI_Wtime")));
Packit Service c5cf8c
#endif
Packit Service c5cf8c
/* -- End Profiling Symbol Block */
Packit Service c5cf8c
Packit Service c5cf8c
/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
Packit Service c5cf8c
   the MPI routines */
Packit Service c5cf8c
#ifndef MPICH_MPI_FROM_PMPI
Packit Service c5cf8c
#undef MPI_Wtime
Packit Service c5cf8c
#define MPI_Wtime PMPI_Wtime
Packit Service c5cf8c
#endif
Packit Service c5cf8c
Packit Service c5cf8c
#undef FUNCNAME
Packit Service c5cf8c
#define FUNCNAME MPI_Wtime
Packit Service c5cf8c
Packit Service c5cf8c
/*@
Packit Service c5cf8c
  MPI_Wtime - Returns an elapsed time on the calling processor
Packit Service c5cf8c
Packit Service c5cf8c
  Return value:
Packit Service c5cf8c
  Time in seconds since an arbitrary time in the past.
Packit Service c5cf8c
Packit Service c5cf8c
  Notes:
Packit Service c5cf8c
  This is intended to be a high-resolution, elapsed (or wall) clock.
Packit Service c5cf8c
  See 'MPI_WTICK' to determine the resolution of 'MPI_WTIME'.
Packit Service c5cf8c
  If the attribute 'MPI_WTIME_IS_GLOBAL' is defined and true, then the
Packit Service c5cf8c
  value is synchronized across all processes in 'MPI_COMM_WORLD'.
Packit Service c5cf8c
Packit Service c5cf8c
  Notes for Fortran:
Packit Service c5cf8c
  This is a function, declared as 'DOUBLE PRECISION MPI_WTIME()' in Fortran.
Packit Service c5cf8c
Packit Service c5cf8c
.see also: MPI_Wtick, MPI_Comm_get_attr, MPI_Attr_get
Packit Service c5cf8c
@*/
Packit Service c5cf8c
double MPI_Wtime(void)
Packit Service c5cf8c
{
Packit Service c5cf8c
    double d;
Packit Service c5cf8c
    MPID_Time_t t;
Packit Service c5cf8c
    MPIR_FUNC_TERSE_STATE_DECL(MPID_STATE_MPI_WTIME);
Packit Service c5cf8c
Packit Service c5cf8c
    MPIR_ERRTEST_INITIALIZED_ORDIE();
Packit Service c5cf8c
Packit Service c5cf8c
    MPIR_FUNC_TERSE_ENTER(MPID_STATE_MPI_WTIME);
Packit Service c5cf8c
    MPID_Wtime(&t);
Packit Service c5cf8c
    MPID_Wtime_todouble(&t, &d);
Packit Service c5cf8c
    MPIR_FUNC_TERSE_EXIT(MPID_STATE_MPI_WTIME);
Packit Service c5cf8c
Packit Service c5cf8c
    return d;
Packit Service c5cf8c
}