xref: /petsc/include/petsclog.h (revision 0601ba50a5dd1e69826c4973ef02471f63cab2d6)
1 /* $Id: plog.h,v 1.49 1996/02/23 15:05:25 balay Exp balay $ */
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 an event here, make sure you add to petsc/bin/petscview.cfg,
13   petsc/bin/petscview  and petsc/src/sys/src/plog.c!!
14 */
15 #define MAT_Mult                                0
16 #define MAT_MatrixFreeMult                      1
17 #define MAT_AssemblyBegin                       2
18 #define MAT_AssemblyEnd                         3
19 #define MAT_GetReordering                       4
20 #define MAT_MultTrans                           5
21 #define MAT_MultAdd                             6
22 #define MAT_MultTransAdd                        7
23 #define MAT_LUFactor                            8
24 #define MAT_CholeskyFactor                      9
25 #define MAT_LUFactorSymbolic                    10
26 #define MAT_ILUFactorSymbolic                   11
27 #define MAT_CholeskyFactorSymbolic              12
28 #define MAT_IncompleteCholeskyFactorSymbolic    13
29 #define MAT_LUFactorNumeric                     14
30 #define MAT_CholeskyFactorNumeric               15
31 #define MAT_Relax                               16
32 #define MAT_Copy                                17
33 #define MAT_Convert                             18
34 #define MAT_Scale                               19
35 #define MAT_ZeroEntries                         20
36 #define MAT_Solve                               21
37 #define MAT_SolveAdd                            22
38 #define MAT_SolveTrans                          23
39 #define MAT_SolveTransAdd                       24
40 #define MAT_SetValues                           25
41 #define MAT_ForwardSolve                        26
42 #define MAT_BackwardSolve                       27
43 #define MAT_Load                                28
44 #define MAT_View                                29
45 #define MAT_ILUFactor                           30
46 #define MAT_GetSubMatrix                        31
47 #define MAT_GetSubMatrices                      32
48 #define MAT_GetValues                           33
49 #define MAT_IncreaseOverlap                     34
50 #define MAT_GetRow                              35
51 
52 #define VEC_Dot                                 40
53 #define VEC_Norm                                41
54 #define VEC_Max                                 42
55 #define VEC_Min                                 43
56 #define VEC_TDot                                44
57 #define VEC_Scale                               45
58 #define VEC_Copy                                46
59 #define VEC_Set                                 47
60 #define VEC_AXPY                                48
61 #define VEC_AYPX                                49
62 #define VEC_Swap                                50
63 #define VEC_WAXPY                               51
64 #define VEC_AssemblyBegin                       52
65 #define VEC_AssemblyEnd                         53
66 #define VEC_MTDot                               54
67 #define VEC_MDot                                55
68 #define VEC_MAXPY                               56
69 #define VEC_PMult                               57
70 #define VEC_SetValues                           58
71 #define VEC_Load                                59
72 #define VEC_View                                60
73 #define VEC_ScatterBegin                        61
74 #define VEC_ScatterEnd                          62
75 #define VEC_SetRandom                           63
76 
77 #define SLES_Solve                              70
78 #define SLES_SetUp                              71
79 
80 #define KSP_GMRESOrthogonalization              72
81 #define KSP_Solve                               73
82 
83 #define PC_SetUp                                75
84 #define PC_Apply                                76
85 #define PC_ApplySymmLeft                        77
86 #define PC_ApplySymmRight                       78
87 
88 #define SNES_Solve                              80
89 #define SNES_LineSearch                         81
90 #define SNES_FunctionEval                       82
91 #define SNES_JacobianEval                       83
92 #define SNES_MinimizationFunctionEval           84
93 #define SNES_GradientEval                       85
94 #define SNES_HessianEval                        86
95 
96 #define TS_Step                                 90
97 /*
98    Event numbers PLOG_USER_EVENT_LOW to PLOG_USER_EVENT_HIGH are reserved
99    for applications.  Make sure that src/sys/src/plog.c defines enough
100    entries in (*name)[] to go up to PLOG_USER_EVENT_HIGH.
101 */
102 #define PLOG_USER_EVENT_LOW_STATIC              120
103 #define PLOG_USER_EVENT_HIGH                    200
104 
105 /* Global flop counter */
106 extern double _TotalFlops;
107 #if defined(PETSC_LOG)
108 #define PLogFlops(n) {_TotalFlops += n;}
109 #else
110 #define PLogFlops(n)
111 #endif
112 
113 
114 /*M
115    PLogFlops - Adds floating point operations to the global counter.
116                You must include "plog.h" to use this function.
117 
118    Input Parameter:
119 .  f - flop counter
120 
121    Synopsis:
122    PLogFlops(int f)
123 
124    Notes:
125    A global counter logs all PETSc flop counts.  The user can use
126    PLogFlops() to increment this counter to include flops for the
127    application code.
128 
129    PETSc automatically logs library events if the code has been
130    compiled with -DPETSC_LOG (which is the default), and -log,
131    -log_summary, or -log_all are specified.  PLogFlops() is
132    intended for logging user flops to supplement this PETSc
133    information.
134 
135     Example of Usage:
136 $     int USER_EVENT;
137 $     PLogEventRegister(&USER_EVENT,"User event");
138 $     PLogEventBegin(USER_EVENT,0,0,0,0);
139 $     [code segment to monitor]
140 $     PLogFlops(user_flops)
141 $     PLogEventEnd(USER_EVENT,0,0,0,0);
142 
143 .seealso:  PLogEventRegister(), PLogEventBegin(), PLogEventEnd()
144 
145 .keywords:  Petsc, log, flops, floating point operations
146 M*/
147 
148 extern int PLogPrint(MPI_Comm,FILE *);
149 extern int PLogBegin();
150 extern int PLogAllBegin();
151 extern int PLogUpshotBegin();
152 extern int PLogAllUpshotBegin();
153 extern int PLogDump(char*);
154 
155 #if defined(PETSC_LOG)
156 
157 extern int (*_PLB)(int,int,PetscObject,PetscObject,PetscObject,PetscObject);
158 extern int (*_PLE)(int,int,PetscObject,PetscObject,PetscObject,PetscObject);
159 extern int (*_PHC)(PetscObject);
160 extern int (*_PHD)(PetscObject);
161 extern int PLogEventRegister(int*,char*);
162 
163 /*M
164    PLogEventBegin - Logs the beginning of a user event.
165 
166    Input Parameters:
167 .  e - integer associated with the event obtained from PLogEventRegister()
168 .  o1,o2,o3,o4 - objects associated with the event, or 0
169 
170    Synopsis:
171    PLogEventBegin(int e,PetscObject o1,PetscObject o2,PetscObject o3,
172                   PetscObject o4)
173 
174    Notes:
175    You should also register each integer event with the command
176    PLogRegisterEvent().  The source code must be compiled with
177    -DPETSC_LOG, which is the default.
178 
179    PETSc automatically logs library events if the code has been
180    compiled with -DPETSC_LOG, and -log, -log_summary, or -log_all are
181    specified.  PLogEventBegin() is intended for logging user events
182    to supplement this PETSc information.
183 
184     Example of Usage:
185 $     int USER_EVENT;
186 $     int user_event_flops;
187 $     PLogEventRegister(&USER_EVENT,"User event");
188 $     PLogEventBegin(&USER_EVENT,0,0,0,0);
189 $        [code segment to monitor]
190 $        PLogFlops(user_event_flops);
191 $     PLogEventEnd(&USER_EVENT,0,0,0,0);
192 
193 .seealso: PLogEventRegister(), PLogEventEnd(), PLogFlops()
194 
195 .keywords: log, event, begin
196 M*/
197 #define PLogEventBegin(e,o1,o2,o3,o4) {static int _tacky = 0;\
198           { _tacky++;if (_PLB) (*_PLB)(e,_tacky,(PetscObject)o1,\
199            (PetscObject)o2,(PetscObject)o3,(PetscObject)o4);};
200 
201 /*M
202    PLogEventEnd - Log the end of a user event.
203 
204    Input Parameters:
205 .  e - integer associated with the event obtained with PLogEventRegister()
206 .  o1,o2,o3,o4 - objects associated with the event, or 0
207 
208    Synopsis:
209    PLogEventEnd(int e,PetscObject o1,PetscObject o2,PetscObject o3,
210                 PetscObject o4)
211 
212    Notes:
213    You should also register each integer event with the command
214    PLogRegisterEvent(). Source code must be compiled with
215    -DPETSC_LOG, which is the default.
216 
217    PETSc automatically logs library events if the code has been
218    compiled with -DPETSC_LOG, and -log, -log_summary, or -log_all are
219    specified.  PLogEventEnd() is intended for logging user events
220    to supplement this PETSc information.
221 
222     Example of Usage:
223 $     int USER_EVENT;
224 $     int user_event_flops;
225 $     PLogEventRegister(&USER_EVENT,"User event");
226 $     PLogEventBegin(USER_EVENT,0,0,0,0);
227 $        [code segment to monitor]
228 $        PLogFlops(user_event_flops);
229 $     PLogEventEnd(USER_EVENT,0,0,0,0);
230 
231 .seealso: PLogEventRegister(), PLogEventBegin(), PLogFlops()
232 
233 .keywords: log, event, end
234 M*/
235 #define PLogEventEnd(e,o1,o2,o3,o4) {if (_PLE) (*_PLE)(e,_tacky,(PetscObject)o1,\
236                                     (PetscObject)o2,(PetscObject)o3,(PetscObject)o4);}\
237                                     _tacky--;}
238 #define PLogObjectParent(p,c)       {PETSCVALIDHEADER((PetscObject)c); \
239                                      PETSCVALIDHEADER((PetscObject)p);\
240                                      ((PetscObject)(c))->parent = (PetscObject) p;}
241 #define PLogObjectParents(p,n,d)    {int _i; for ( _i=0; _i<n; _i++ ) \
242                                     PLogObjectParent(p,(d)[_i]);}
243 #define PLogObjectCreate(h)         {if (_PHC) (*_PHC)((PetscObject)h);}
244 #define PLogObjectDestroy(h)        {if (_PHD) (*_PHD)((PetscObject)h);}
245 #define PLogObjectMemory(p,m)       {PETSCVALIDHEADER((PetscObject)p);\
246                                     ((PetscObject)(p))->mem += (m);}
247 extern int PLogObjectState(PetscObject,char *,...);
248 extern int PLogInfo(PetscObject,char*,...);
249 extern int PLogDestroy();
250 extern int PLogStagePush(int);
251 extern int PLogStagePop();
252 extern int PLogStageRegister(int,char*);
253 
254 #else
255 
256 #define PLogObjectCreate(h)
257 #define PLogObjectDestroy(h)
258 #define PLogObjectMemory(p,m)
259 #define PLogEventBegin(e,o1,o2,o3,o4)
260 #define PLogEventEnd(e,o1,o2,o3,o4)
261 #define PLogObjectParent(p,c)
262 #define PLogObjectParents(p,n,c)
263 extern int PLogInfo(PetscObject,char*,...);
264 extern int PLogDestroy();
265 extern int PLogStagePush(int);
266 extern int PLogStagePop();
267 extern int PLogStageRegister(int,char*);
268 #endif
269 
270 #endif
271 
272