/usr/lib/petscdir/3.4.2/include/petsctime.h is in libpetsc3.4.2-dev 3.4.2.dfsg1-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | /*
Low cost access to system time. This, in general, should not
be included in user programs.
*/
#if !defined(__PETSCTIME_H)
#define __PETSCTIME_H
#include <petscsys.h>
PETSC_EXTERN PetscErrorCode PetscGetCPUTime(PetscLogDouble*);
/* Global counters */
PETSC_EXTERN PetscLogDouble petsc_BaseTime;
/*MC
PetscTime - Returns the current time of day in seconds.
Synopsis:
#include "petsctime.h"
PetscTime(PetscLogDouble *v)
Not Collective
Output Parameter:
. v - time counter
Usage:
PetscLogDouble v;
PetscTime(&v);
.... perform some calculation ...
printf("Time for operation %g\n",v);
Level: developer
Notes:
Since the PETSc libraries incorporate timing of phases and operations,
we do not recomment every using PetscTime()
The options database command -log_summary activate
PETSc library timing. See the <A href="../../docs/manual.pdf">Users Manual</A> for more details.
.seealso: PetscTimeSubtract(), PetscTimeAdd(), PetscLogStageRegister(), PetscLogEventRegister(), PetscLogEventBegin(), PetscLogEventEnd()
.keywords: Petsc, time
M*/
/*MC
PetscTimeSubtract - Subtracts the current time of day (in seconds) from
the value v.
Synopsis:
#include "petsctime.h"
PetscTimeSubtract(&PetscLogDouble *v)
Not Collective
Input Parameter:
. v - time counter
Output Parameter:
. v - time counter (v = v - current time)
Level: developer
Notes:
Since the PETSc libraries incorporate timing of phases and operations,
we do not every recommend using PetscTimeSubtract()
The options database command -log_summary activates
PETSc library timing. See the <A href="../../docs/manual.pdf">Users Manual</A> for more details, also
see PetscLogStageRegister(), PetscLogEventRegister(), PetscLogEventBegin(), PetscLogEventEnd() for how to register
stages and events in application codes.
.seealso: PetscTime(), PetscTimeAdd(), PetscLogStageRegister(), PetscLogEventRegister(), PetscLogEventBegin(), PetscLogEventEnd()
.keywords: Petsc, time, subtract
M*/
/*MC
PetscTimeAdd - Adds the current time of day (in seconds) to the value v.
Synopsis:
#include "petsctime.h"
PetscTimeAdd(PetscLogDouble *v)
Not Collective
Input Parameter:
. v - time counter
Output Parameter:
. v - time counter (v = v + current time)
Level: developer
Notes:
Since the PETSc libraries incorporate timing of phases and operations,
we do not ever recommend using PetscTimeAdd().
The options database command -log_summary activate
PETSc library timing. See the <A href="../../docs/manual.pdf">Users Manual</A> for more details.
.seealso: PetscTime(), PetscTimeSubtract(), PetscLogStageRegister(), PetscLogEventRegister(), PetscLogEventBegin(), PetscLogEventEnd()
.keywords: Petsc, time, add
M*/
/* ------------------------------------------------------------------
Some machines have very fast MPI_Wtime()
*/
#if (defined(PETSC_HAVE_FAST_MPI_WTIME) && !defined(__MPIUNI_H))
PETSC_STATIC_INLINE PetscErrorCode PetscTime(PetscLogDouble *v)
{
*v = MPI_Wtime();
return 0;
}
PETSC_STATIC_INLINE PetscErrorCode PetscTimeSubtract(PetscLogDouble *v)
{
*v -= MPI_Wtime();
return 0;
}
PETSC_STATIC_INLINE PetscErrorCode PetscTimeAdd(PetscLogDouble *v)
{
*v += MPI_Wtime();
return 0;
}
/* ------------------------------------------------------------------
IBM Power and PowerPC machines have a fast clock read_real_time()
*/
#elif defined(PETSC_USE_READ_REAL_TIME)
PETSC_EXTERN PetscLogDouble PetscReadRealTime(void);
PETSC_STATIC_INLINE PetscErrorCode PetscTime(PetscLogDouble *v)
{
*v = PetscReadRealTime();
return 0;
}
PETSC_STATIC_INLINE PetscErrorCode PetscTimeSubtract(PetscLogDouble *v)
{
*v -= PetscReadRealTime();
return 0;
}
PETSC_STATIC_INLINE PetscErrorCode PetscTimeAdd(PetscLogDouble *v)
{
*v += PetscReadRealTime();
return 0;
}
/* ------------------------------------------------------------------
Microsoft Windows has its own time routines
*/
#elif defined (PETSC_USE_MICROSOFT_TIME)
#include <time.h>
PETSC_EXTERN PetscLogDouble PetscMicrosoftTime(void);
PETSC_STATIC_INLINE PetscErrorCode PetscTime(PetscLogDouble *v)
{
*v = PetscMicrosoftTime();
return 0;
}
PETSC_STATIC_INLINE PetscErrorCode PetscTimeSubtract(PetscLogDouble *v)
{
*v -= PetscMicrosoftTime();
return 0;
}
PETSC_STATIC_INLINE PetscErrorCode PetscTimeAdd(PetscLogDouble *v)
{
*v += PetscMicrosoftTime();
return 0;
}
/* ------------------------------------------------------------------
The usual Unix time routines.
*/
#else
#if defined(PETSC_HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#if defined(PETSC_NEEDS_GETTIMEOFDAY_PROTO)
PETSC_EXTERN int gettimeofday(struct timeval *,struct timezone *);
#endif
PETSC_STATIC_INLINE PetscErrorCode PetscTime(PetscLogDouble *v)
{
static struct timeval _tp;
gettimeofday(&_tp,(struct timezone *)0);
*v = ((PetscLogDouble)_tp.tv_sec)+(1.0e-6)*(_tp.tv_usec);
return 0;
}
PETSC_STATIC_INLINE PetscErrorCode PetscTimeSubtract(PetscLogDouble *v)
{
static struct timeval _tp;
gettimeofday(&_tp,(struct timezone *)0);
*v -= ((PetscLogDouble)_tp.tv_sec)+(1.0e-6)*(_tp.tv_usec);
return 0;
}
PETSC_STATIC_INLINE PetscErrorCode PetscTimeAdd(PetscLogDouble *v)
{
static struct timeval _tp;
gettimeofday(&_tp,(struct timezone *)0);
*v += ((PetscLogDouble)_tp.tv_sec)+(1.0e-6)*(_tp.tv_usec);
return 0;
}
#endif
#endif
|