1 2 #include <petscsys.h> 3 #include <petsctime.h> 4 5 int main(int argc,char **argv) 6 { 7 PetscLogDouble x,y; 8 PetscInt i; 9 10 PetscCall(PetscInitialize(&argc,&argv,0,0)); 11 /* To take care of paging effects */ 12 PetscCall(PetscTime(&y)); 13 14 for (i=0; i<2; i++) { 15 PetscCall(PetscTime(&x)); 16 PetscCall(PetscTime(&y)); 17 PetscCall(PetscTime(&y)); 18 PetscCall(PetscTime(&y)); 19 PetscCall(PetscTime(&y)); 20 PetscCall(PetscTime(&y)); 21 PetscCall(PetscTime(&y)); 22 PetscCall(PetscTime(&y)); 23 PetscCall(PetscTime(&y)); 24 PetscCall(PetscTime(&y)); 25 PetscCall(PetscTime(&y)); 26 fprintf(stdout,"%-15s : %e sec\n","PetscTime",(y-x)/10.0); 27 } 28 29 PetscCall(PetscFinalize()); 30 return 0; 31 } 32