xref: /petsc/src/benchmarks/PLogEvent.c (revision 029af93f72d387caa45cf6909ac9aed2d04296ca)
1 #ifndef lint
2 static char vcid[] = "$Id: PLogEvent.c,v 1.6 1996/03/19 21:30:13 bsmith Exp bsmith $";
3 #endif
4 
5 #include "stdio.h"
6 #include "petsc.h"
7 
8 int main( int argc, char **argv)
9 {
10   PLogDouble x, y;
11   int        e1, flg;
12 
13   PetscInitialize(&argc, &argv,0,0);
14   PLogEventRegister(&e1,"*DummyEvent     ", "red:");
15   /* To take care of the paging effects */
16   PLogEventBegin(e1,&x,0,0,0);
17   PLogEventEnd(e1,&x,0,0,0);
18   x = PetscGetTime();
19 
20   x = PetscGetTime();
21   /* 10 Occurences of the dummy event */
22   PLogEventBegin(e1,&x,0,0,0);
23   PLogEventEnd(e1,&x,0,0,0);
24   PLogEventBegin(e1,&x,&y,0,0);
25   PLogEventEnd(e1,&x,&y,0,0);
26   PLogEventBegin(e1,&y,0,0,0);
27   PLogEventEnd(e1,&y,0,0,0);
28   PLogEventBegin(e1,&x,0,0,0);
29   PLogEventEnd(e1,&x,0,0,0);
30   PLogEventBegin(e1,&x,&y,0,0);
31   PLogEventEnd(e1,&x,&y,0,0);
32   PLogEventBegin(e1,&y,0,0,0);
33   PLogEventEnd(e1,&y,0,0,0);
34   PLogEventBegin(e1,&x,0,0,0);
35   PLogEventEnd(e1,&x,0,0,0);
36   PLogEventBegin(e1,&x,&y,0,0);
37   PLogEventEnd(e1,&x,&y,0,0);
38   PLogEventBegin(e1,&y,0,0,0);
39   PLogEventEnd(e1,&y,0,0,0);
40   PLogEventBegin(e1,&x,&e1,0,0);
41   PLogEventEnd(e1,&x,&e1,0,0);
42 
43   y = PetscGetTime();
44   fprintf(stderr,"%-15s : %e sec , with options : ","PLogEvent",(y-x)/10.0);
45 
46   if(OptionsHasName(PETSC_NULL,"-log",&flg),flg) fprintf(stderr,"-log ");
47   if(OptionsHasName(PETSC_NULL,"-log_all",&flg),flg) fprintf(stderr,"-log_all ");
48   if(OptionsHasName(PETSC_NULL,"-log_summary",&flg),flg) fprintf(stderr,"-log_summary ");
49   if(OptionsHasName(PETSC_NULL,"-log_mpe",&flg),flg) fprintf(stderr,"-log_mpe ");
50 
51   fprintf(stderr,"\n");
52 
53   PetscFinalize();
54   return 0;
55 }
56