xref: /petsc/include/petsclog.h (revision a935fc98aa0ada3a65f6943302157d2323c0d5aa)
1 /* $Id: plog.h,v 1.2 1995/07/12 18:53:11 curfman Exp curfman $ */
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 #define SNES_UMFunctionEval                     64
72 #define SNES_GradientEval                       65
73 #define SNES_HessianEval                        66
74 
75 /* event numbers 70 to 89 are reserved for applications */
76 
77 #if defined(PETSC_LOG)
78 
79 extern int (*_PLB)(int,int,PetscObject,PetscObject,PetscObject,PetscObject);
80 extern int (*_PLE)(int,int,PetscObject,PetscObject,PetscObject,PetscObject);
81 extern int (*_PHC)(PetscObject);
82 extern int (*_PHD)(PetscObject);
83 extern int PLogEventRegister(int,char*);
84 
85 /*M
86    PLogEventBegin - Logs the beginning of a user event.  Note that
87    petsc/include/plog.h MUST be included in the user's code to employ
88    this function.
89 
90    Input Parameters:
91 .  e - integer associated with the event (69 < e < 89)
92 .  o1,o2,o3,o4 - objects associated with the event, or 0
93 
94    Synopsis:
95    PLogEventBegin(int e,PetscObject o1,PetscObject o2,PetscObject o3,
96                   PetscObject o4)
97 
98    Notes:
99    You should also register each integer event with the command
100    PLogRegisterEvent().  The source code must be compiled with
101    -DPETSC_LOG, which is the default.
102 
103    PETSc automatically logs library events if the code has been
104    compiled with -DPETSC_LOG, and -log, -log_summary, or -log_all are
105    specified.  PLogEventBegin() is intended for logging user events
106    to supplement this PETSc information.
107 
108     Example of Usage:
109 $     #define USER_EVENT 75
110 $     int user_event_flops;
111 $     PLogEventRegister(USER_EVENT,"User event");
112 $     PLogEventBegin(USER_EVENT,0,0,0,0);
113 $        [code segment to monitor]
114 $        PLogFlops(user_event_flops);
115 $     PLogEventEnd(USER_EVENT,0,0,0,0);
116 
117 .seealso: PLogEventRegister(), PLogEventEnd(), PLogFlops()
118 
119 .keywords: log, event, begin
120 M*/
121 #define PLogEventBegin(e,o1,o2,o3,o4) {static int _tacky = 0;\
122           { _tacky++;if (_PLB) (*_PLB)(e,_tacky,(PetscObject)o1,\
123            (PetscObject)o2,(PetscObject)o3,(PetscObject)o4);};
124 
125 /*M
126    PLogEventEnd - Log the end of a user event.  Note that
127    petsc/include/plog.h MUST be included in the user's code to employ
128    this function.
129 
130    Input Parameters:
131 .  e - integer associated with the event (69 < e < 89)
132 .  o1,o2,o3,o4 - objects associated with the event, or 0
133 
134    Synopsis:
135    PLogEventEnd(int e,PetscObject o1,PetscObject o2,PetscObject o3,
136                 PetscObject o4)
137 
138    Notes:
139    You should also register each integer event with the command
140    PLogRegisterEvent(). Source code must be compiled with
141    -DPETSC_LOG, which is the default.
142 
143    PETSc automatically logs library events if the code has been
144    compiled with -DPETSC_LOG, and -log, -log_summary, or -log_all are
145    specified.  PLogEventEnd() is intended for logging user events
146    to supplement this PETSc information.
147 
148     Example of Usage:
149 $     #define USER_EVENT 75
150 $     int user_event_flops;
151 $     PLogEventRegister(USER_EVENT,"User event");
152 $     PLogEventBegin(USER_EVENT,0,0,0,0);
153 $        [code segment to monitor]
154 $        PLogFlops(user_event_flops);
155 $     PLogEventEnd(USER_EVENT,0,0,0,0);
156 
157 .seealso: PLogEventRegister(), PLogEventBegin(), PLogFlops()
158 
159 .keywords: log, event, end
160 M*/
161 #define PLogEventEnd(e,o1,o2,o3,o4) \
162           { if (_PLE) (*_PLE)(e,_tacky,(PetscObject)o1,(PetscObject)o2,\
163                              (PetscObject)o3,(PetscObject)o4);} _tacky--;}
164 #define PLogObjectParent(p,c) {((PetscObject)(c))->parent = (PetscObject) p;}
165 #define PLogObjectParents(p,n,d) {int _i; for ( _i=0; _i<n; _i++ ) \
166           PLogObjectParent(p,(d)[_i]);}
167 #define PLogObjectCreate(h) {if (_PHC) (*_PHC)((PetscObject)h);}
168 #define PLogObjectDestroy(h) {if (_PHD) (*_PHD)((PetscObject)h);}
169 extern int PLogObjectState(PetscObject,char *,...);
170 extern int PLogInfo(PetscObject,char*,...);
171 
172 #else
173 
174 #define PLogObjectCreate(h)
175 #define PLogObjectDestroy(h)
176 #define PLogEventBegin(e,o1,o2,o3,o4)
177 #define PLogEventEnd(e,o1,o2,o3,o4)
178 #define PLogObjectParent(p,c)
179 #define PLogObjectParents(p,n,c)
180 extern int PLogInfo(PetscObject,char*,...);
181 #endif
182 
183 #endif
184