Actual source code: MPI_Wtime.c

  1: #include <petscsys.h>

  3: int main(int argc,char **argv)
  4: {
  5:   double x,y;
  6:   int    ierr;

  8:   PetscCall(PetscInitialize(&argc,&argv,0,0));
  9:   /* To take care of paging effects */
 10:   y = MPI_Wtime();

 12:   x = MPI_Wtime();
 13:   y = MPI_Wtime();
 14:   y = MPI_Wtime();
 15:   y = MPI_Wtime();
 16:   y = MPI_Wtime();
 17:   y = MPI_Wtime();
 18:   y = MPI_Wtime();
 19:   y = MPI_Wtime();
 20:   y = MPI_Wtime();
 21:   y = MPI_Wtime();
 22:   y = MPI_Wtime();

 24:   fprintf(stdout,"%-15s : %e sec\n","MPI_Wtime",(y-x)/10.0);
 25:   y = MPI_Wtick();
 26:   fprintf(stdout,"%-15s : %e sec\n","MPI_Wtick",y);

 28:   x    = MPI_Wtime();
 29:   PetscCall(PetscSleep(10));
 30:   y    = MPI_Wtime();
 31:   fprintf(stdout,"%-15s : %e sec - Slept for 10 sec \n","MPI_Wtime",(y-x));

 33:   PetscCall(PetscFinalize());
 34:   return 0;
 35: }