xref: /petsc/include/petsclog.h (revision 97bb86f703153049af9d2ecdb7ac4165d3154956)
1 /* $Id: plog.h,v 1.21 1995/07/12 15:32:21 curfman Exp $ */
2 
3 /*
4     Defines high level logging in Petsc.
5 */
6 
7 #if !defined(__PLOG_PACKAGE)
8 #define __PLOG_PACKAGE
9 #include "petsc.h"
10 
11 /*
12     If you add it here, make sure you add to petsc/bin/tkreview!
13   and in src/sys/src/plog.c
14 */
15 #define MAT_Mult                                0
16 #define MAT_BeginAssembly                       1
17 #define MAT_EndAssembly                         2
18 #define MAT_GetReordering                       3
19 #define MAT_MultTrans                           4
20 #define MAT_MultAdd                             5
21 #define MAT_MultTransAdd                        6
22 #define MAT_LUFactor                            7
23 #define MAT_CholeskyFactor                      8
24 #define MAT_LUFactorSymbolic                    9
25 #define MAT_ILUFactorSymbolic                   10
26 #define MAT_CholeskyFactorSymbolic              11
27 #define MAT_IncompleteCholeskyFactorSymbolic    12
28 #define MAT_LUFactorNumeric                     13
29 #define MAT_CholeskyFactorNumeric               14
30 #define MAT_Relax                               15
31 #define MAT_Copy                                16
32 #define MAT_Convert                             17
33 #define MAT_Scale                               18
34 #define MAT_ZeroEntries                         19
35 #define MAT_Solve                               20
36 #define MAT_SolveAdd                            21
37 #define MAT_SolveTrans                          22
38 #define MAT_SolveTransAdd                       23
39 #define MAT_SetValues                           24
40 
41 #define VEC_Dot                                 30
42 #define VEC_Norm                                31
43 #define VEC_ASum                                32
44 #define VEC_AMax                                33
45 #define VEC_Max                                 34
46 #define VEC_Min                                 35
47 #define VEC_TDot                                36
48 #define VEC_Scale                               37
49 #define VEC_Copy                                38
50 #define VEC_Set                                 39
51 #define VEC_AXPY                                40
52 #define VEC_AYPX                                41
53 #define VEC_Swap                                42
54 #define VEC_WAXPY                               43
55 #define VEC_BeginAssembly                       44
56 #define VEC_EndAssembly                         45
57 #define VEC_MTDot                               46
58 #define VEC_MDot                                47
59 #define VEC_MAXPY                               48
60 #define VEC_PMult                               49
61 
62 #define SLES_Solve                              55
63 #define PC_SetUp                                56
64 #define PC_Apply                                57
65 #define SLES_SetUp                              58
66 
67 #define SNES_Solve                              60
68 #define SNES_LineSearch                         61
69 #define SNES_FunctionEval                       62
70 #define SNES_JacobianEval                       63
71 
72 /* event numbers 70 to 89 are reserved for applications */
73 
74 #if defined(PETSC_LOG)
75 
76 extern int (*_PLB)(int,int,PetscObject,PetscObject,PetscObject,PetscObject);
77 extern int (*_PLE)(int,int,PetscObject,PetscObject,PetscObject,PetscObject);
78 extern int (*_PHC)(PetscObject);
79 extern int (*_PHD)(PetscObject);
80 extern int PLogEventRegister(int,char*);
81 
82 /*M
83    PLogEventBegin - Logs the beginning of a user event.  Note that
84    pinclude/plog.h must be included in the user's code to employ
85    this function.
86 
87    Input Parameters:
88 .  e - integer associated with the event (69 < e < 89)
89 .  o1,o2,o3,o4 - objects associated with the event, or 0
90 
91    Synopsis:
92    PLogEventBegin(int e,PetscObject o1,PetscObject o2,PetscObject o3,
93                   PetscObject o4)
94 
95    Notes:
96    You should also register each integer event with the command
97    PLogRegisterEvent().  The source code must be compiled with
98    -DPETSC_LOG, which is the default.
99 
100    PETSc automatically logs library events if the code has been
101    compiled with -DPETSC_LOG, and -log, -log_summary, or -log_all are
102    specified.  PLogEventBegin() is intended for logging user events
103    to supplement this PETSc information.
104 
105     Example of Usage:
106 $     #define USER_EVENT 75
107 $     PLogEventRegister(USER_EVENT,"User event");
108 $     PLogEventBegin(USER_EVENT,0,0,0,0);
109 $     [code segment to monitor]
110 $     PLogFlops(user_flops)
111 $     PLogEventEnd(USER_EVENT,0,0,0,0);
112 
113 .seealso: PLogEventRegister(), PLogEventEnd(), PLogFlops()
114 
115 .keywords: log, event, begin
116 M*/
117 #define PLogEventBegin(e,o1,o2,o3,o4) {static int _tacky = 0;\
118           { _tacky++;if (_PLB) (*_PLB)(e,_tacky,(PetscObject)o1,\
119            (PetscObject)o2,(PetscObject)o3,(PetscObject)o4);};
120 
121 /*M
122    PLogEventEnd - Log the end of a user event.  Note that
123    pinclude/plog.h must be included in the user's code to employ
124    this function.
125 
126    Input Parameters:
127 .  e - integer associated with the event (69 < e < 89)
128 .  o1,o2,o3,o4 - objects associated with the event, or 0
129 
130    Synopsis:
131    PLogEventEnd(int e,PetscObject o1,PetscObject o2,PetscObject o3,
132                 PetscObject o4)
133 
134    Notes:
135    You should also register each integer event with the command
136    PLogRegisterEvent(). Source code must be compiled with
137    -DPETSC_LOG, which is the default.
138 
139    PETSc automatically logs library events if the code has been
140    compiled with -DPETSC_LOG, and -log, -log_summary, or -log_all are
141    specified.  PLogEventEnd() is intended for logging user events
142    to supplement this PETSc information.
143 
144     Example of Usage:
145 $     #define USER_EVENT 75
146 $     PLogEventRegister(USER_EVENT,"User event");
147 $     PLogEventBegin(USER_EVENT,0,0,0,0);
148 $     [code segment to monitor]
149 $     PLogFlops(user_flops)
150 $     PLogEventEnd(USER_EVENT,0,0,0,0);
151 
152 .seealso: PLogEventRegister(), PLogEventBegin(), PLogFlops()
153 
154 .keywords: log, event, end
155 M*/
156 #define PLogEventEnd(e,o1,o2,o3,o4) \
157           { if (_PLE) (*_PLE)(e,_tacky,(PetscObject)o1,(PetscObject)o2,\
158                              (PetscObject)o3,(PetscObject)o4);} _tacky--;}
159 #define PLogObjectParent(p,c) {((PetscObject)(c))->parent = (PetscObject) p;}
160 #define PLogObjectParents(p,n,d) {int _i; for ( _i=0; _i<n; _i++ ) \
161           PLogObjectParent(p,(d)[_i]);}
162 #define PLogObjectCreate(h) {if (_PHC) (*_PHC)((PetscObject)h);}
163 #define PLogObjectDestroy(h) {if (_PHD) (*_PHD)((PetscObject)h);}
164 extern int PLogObjectState(PetscObject,char *,...);
165 extern int PLogInfo(PetscObject,char*,...);
166 
167 #else
168 
169 #define PLogObjectCreate(h)
170 #define PLogObjectDestroy(h)
171 #define PLogEventBegin(e,o1,o2,o3,o4)
172 #define PLogEventEnd(e,o1,o2,o3,o4)
173 #define PLogObjectParent(p,c)
174 #define PLogObjectParents(p,n,c)
175 extern int PLogInfo(PetscObject,char*,...);
176 #endif
177 
178 #endif
179