Date: 2022-03-31T04:49:09+00:00

Actual source code: PetscTime.c

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

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

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

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