Actual source code: PetscTime.c
petsc-3.6.4 2016-04-12
2: #include <petscsys.h>
3: #include <petsctime.h>
7: int main(int argc,char **argv)
8: {
9: PetscLogDouble x,y;
10: int i,ierr;
12: PetscInitialize(&argc,&argv,0,0);
13: /* To take care of paging effects */
14: PetscTime(&y);
16: for (i=0; i<2; i++) {
17: PetscTime(&x);
18: PetscTime(&y);
19: PetscTime(&y);
20: PetscTime(&y);
21: PetscTime(&y);
22: PetscTime(&y);
23: PetscTime(&y);
24: PetscTime(&y);
25: PetscTime(&y);
26: PetscTime(&y);
27: PetscTime(&y);
29: fprintf(stdout,"%-15s : %e sec\n","PetscTime",(y-x)/10.0);
30: }
31: PetscTime(&x);
32: PetscSleep(10);
33: PetscTime(&y);
34: fprintf(stdout,"%-15s : %e sec - Slept for 10 sec \n","PetscTime",(y-x));
36: PetscFinalize();
37: return(0);
38: }