xref: /petsc/src/benchmarks/PetscTime.c (revision 73f4d3771d9e6ab3f04055eab794d7609818b9d3)
1 /*$Id: PetscTime.c,v 1.21 2001/08/29 20:23:35 balay Exp $*/
2 
3 #include "petsc.h"
4 #include "petscfix.h"
5 #include "src/sys/src/plog/ptime.h"
6 
7 #undef __FUNCT__
8 #define __FUNCT__ "main"
9 int main(int argc,char **argv)
10 {
11   PetscLogDouble x,y;
12   int            i,ierr;
13 
14   PetscInitialize(&argc,&argv,0,0);
15   /* To take care of paging effects */
16   PetscTime(y);
17 
18   for (i=0; i<2; i++) {
19     PetscTime(x);
20     PetscTime(y);
21     PetscTime(y);
22     PetscTime(y);
23     PetscTime(y);
24     PetscTime(y);
25     PetscTime(y);
26     PetscTime(y);
27     PetscTime(y);
28     PetscTime(y);
29     PetscTime(y);
30 
31     fprintf(stdout,"%-15s : %e sec\n","PetscTime",(y-x)/10.0);
32   }
33   PetscTime(x);
34   ierr = PetscSleep(10);CHKERRQ(ierr);
35   PetscTime(y);
36   fprintf(stdout,"%-15s : %e sec - Slept for 10 sec \n","PetscTime",(y-x));
37 
38   ierr = PetscFinalize();CHKERRQ(ierr);
39   PetscFunctionReturn(0);
40 }
41