Actual source code: PetscTime.c

petsc-3.12.5 2020-03-29
Report Typos and Errors

  2:  #include <petscsys.h>
  3:  #include <petsctime.h>

  5: int main(int argc,char **argv)
  6: {
  7:   PetscLogDouble x,y;
  8:   int            i;

 11:   PetscInitialize(&argc,&argv,0,0);if (ierr) return ierr;
 12:   /* To take care of paging effects */
 13:   PetscTime(&y);

 15:   for (i=0; i<2; i++) {
 16:     PetscTime(&x);
 17:     PetscTime(&y);
 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:     fprintf(stdout,"%-15s : %e sec\n","PetscTime",(y-x)/10.0);
 28:   }
 29:   PetscTime(&x);
 30:   PetscSleep(10);
 31:   PetscTime(&y);
 32:   fprintf(stdout,"%-15s : %e sec - Slept for 10 sec \n","PetscTime",(y-x));
 33:   PetscFinalize();
 34:   return ierr;
 35: }