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