Actual source code: ptime.c
petsc-3.3-p7 2013-05-11
1: #include <petscsys.h>
2: #include <petsctime.h>
6: /*@
7: PetscGetTime - Returns the current time of day in seconds. This
8: returns wall-clock time.
10: Not Collective
12: Output Parameter:
13: . v - time counter
15: Usage:
16: .vb
17: #include <petsctime.h>
19: PetscLogDouble v1,v2,elapsed_time;
20: PetscGetTime(&v1);
21: .... perform some calculation ...
22: PetscGetTime(&v2);
23: elapsed_time = v2 - v1;
24: .ve
26: Notes:
27: Requires explicitly including "petsctime.h"
29: Since the PETSc libraries incorporate timing of phases and operations,
30: PetscGetTime() is intended only for timing of application codes.
31: The options database commands -log, -log_summary, and -log_all activate
32: PETSc library timing.
34: Level: intermediate
36: .seealso: PetscLogEventRegister(), PetscLogEventBegin(), PetscLogEventEnd(), PetscLogStagePush(),
37: PetscLogStagePop(), PetscLogStageRegister(), PetscGetFlops()
39: .keywords: get, time
40: @*/
41: PetscErrorCode PetscGetTime(PetscLogDouble *t)
42: {
44: PetscTime(*t);
45: return(0);
46: }