Actual source code: MPI_Wtime.c
petsc-3.7.1 2016-05-15
Report Typos and Errors

      2: #include <petscsys.h>

      6: int main(int argc,char **argv)
      7: {
      8:   double x,y;
      9:   int    ierr;

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

     15:   x = 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();
     23:   y = MPI_Wtime();
     24:   y = MPI_Wtime();
     25:   y = MPI_Wtime();

     27:   fprintf(stdout,"%-15s : %e sec\n","MPI_Wtime",(y-x)/10.0);
     28:   y = MPI_Wtick();
     29:   fprintf(stdout,"%-15s : %e sec\n","MPI_Wtick",y);

     31:   x    = MPI_Wtime();
     32:   PetscSleep(10);
     33:   y    = MPI_Wtime();
     34:   fprintf(stdout,"%-15s : %e sec - Slept for 10 sec \n","MPI_Wtime",(y-x));

     36:   PetscFinalize();
     37:   return(0);
     38: }