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