xref: /petsc/src/benchmarks/PLogEvent.c (revision f1af5d2ffeae1f5fc391a89939f4818e47770ae3)
1 /*$Id: PLogEvent.c,v 1.15 1999/10/24 14:04:16 bsmith 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, ierr;
11   PetscTruth flg;
12 
13   PetscInitialize(&argc, &argv,0,0);
14   PLogEventRegister(&e1,"*DummyEvent", "red:");
15   /* To take care of the paging effects */
16   ierr = PetscGetTime(&x);CHKERRA(ierr);
17   PLogEventBegin(e1,&x,0,0,0);
18   PLogEventEnd(e1,&x,0,0,0);
19 
20   ierr = PetscGetTime(&x);CHKERRA(ierr);
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   ierr = PetscGetTime(&y);CHKERRA(ierr);
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   PetscFunctionReturn(0);
55 }
56