1 /* $Id: plog.h,v 1.7 1995/08/03 02:55:25 bsmith Exp bsmith $ */ 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 #define MAT_ForwardSolve 25 41 #define MAT_BackwardSolve 26 42 43 #define VEC_Dot 30 44 #define VEC_Norm 31 45 #define VEC_ASum 32 46 #define VEC_AMax 33 47 #define VEC_Max 34 48 #define VEC_Min 35 49 #define VEC_TDot 36 50 #define VEC_Scale 37 51 #define VEC_Copy 38 52 #define VEC_Set 39 53 #define VEC_AXPY 40 54 #define VEC_AYPX 41 55 #define VEC_Swap 42 56 #define VEC_WAXPY 43 57 #define VEC_BeginAssembly 44 58 #define VEC_EndAssembly 45 59 #define VEC_MTDot 46 60 #define VEC_MDot 47 61 #define VEC_MAXPY 48 62 #define VEC_PMult 49 63 64 #define SLES_Solve 55 65 #define PC_SetUp 56 66 #define PC_Apply 57 67 #define SLES_SetUp 58 68 69 #define SNES_Solve 60 70 #define SNES_LineSearch 61 71 #define SNES_FunctionEval 62 72 #define SNES_JacobianEval 63 73 #define SNES_MinimizationFunctionEval 64 74 #define SNES_GradientEval 65 75 #define SNES_HessianEval 66 76 77 /* event numbers 70 to 89 are reserved for applications */ 78 79 #if defined(PETSC_LOG) 80 81 extern int (*_PLB)(int,int,PetscObject,PetscObject,PetscObject,PetscObject); 82 extern int (*_PLE)(int,int,PetscObject,PetscObject,PetscObject,PetscObject); 83 extern int (*_PHC)(PetscObject); 84 extern int (*_PHD)(PetscObject); 85 extern int PLogEventRegister(int,char*); 86 87 /*M 88 PLogEventBegin - Logs the beginning of a user event. Note that 89 petsc/include/plog.h MUST be included in the user's code to employ 90 this function. 91 92 Input Parameters: 93 . e - integer associated with the event (69 < e < 89) 94 . o1,o2,o3,o4 - objects associated with the event, or 0 95 96 Synopsis: 97 PLogEventBegin(int e,PetscObject o1,PetscObject o2,PetscObject o3, 98 PetscObject o4) 99 100 Notes: 101 You should also register each integer event with the command 102 PLogRegisterEvent(). The source code must be compiled with 103 -DPETSC_LOG, which is the default. 104 105 PETSc automatically logs library events if the code has been 106 compiled with -DPETSC_LOG, and -log, -log_summary, or -log_all are 107 specified. PLogEventBegin() is intended for logging user events 108 to supplement this PETSc information. 109 110 Example of Usage: 111 $ #define USER_EVENT 75 112 $ int user_event_flops; 113 $ PLogEventRegister(USER_EVENT,"User event"); 114 $ PLogEventBegin(USER_EVENT,0,0,0,0); 115 $ [code segment to monitor] 116 $ PLogFlops(user_event_flops); 117 $ PLogEventEnd(USER_EVENT,0,0,0,0); 118 119 .seealso: PLogEventRegister(), PLogEventEnd(), PLogFlops() 120 121 .keywords: log, event, begin 122 M*/ 123 #define PLogEventBegin(e,o1,o2,o3,o4) {static int _tacky = 0;\ 124 { _tacky++;if (_PLB) (*_PLB)(e,_tacky,(PetscObject)o1,\ 125 (PetscObject)o2,(PetscObject)o3,(PetscObject)o4);}; 126 127 /*M 128 PLogEventEnd - Log the end of a user event. Note that 129 petsc/include/plog.h MUST be included in the user's code to employ 130 this function. 131 132 Input Parameters: 133 . e - integer associated with the event (69 < e < 89) 134 . o1,o2,o3,o4 - objects associated with the event, or 0 135 136 Synopsis: 137 PLogEventEnd(int e,PetscObject o1,PetscObject o2,PetscObject o3, 138 PetscObject o4) 139 140 Notes: 141 You should also register each integer event with the command 142 PLogRegisterEvent(). Source code must be compiled with 143 -DPETSC_LOG, which is the default. 144 145 PETSc automatically logs library events if the code has been 146 compiled with -DPETSC_LOG, and -log, -log_summary, or -log_all are 147 specified. PLogEventEnd() is intended for logging user events 148 to supplement this PETSc information. 149 150 Example of Usage: 151 $ #define USER_EVENT 75 152 $ int user_event_flops; 153 $ PLogEventRegister(USER_EVENT,"User event"); 154 $ PLogEventBegin(USER_EVENT,0,0,0,0); 155 $ [code segment to monitor] 156 $ PLogFlops(user_event_flops); 157 $ PLogEventEnd(USER_EVENT,0,0,0,0); 158 159 .seealso: PLogEventRegister(), PLogEventBegin(), PLogFlops() 160 161 .keywords: log, event, end 162 M*/ 163 #define PLogEventEnd(e,o1,o2,o3,o4) \ 164 { if (_PLE) (*_PLE)(e,_tacky,(PetscObject)o1,(PetscObject)o2,\ 165 (PetscObject)o3,(PetscObject)o4);} _tacky--;} 166 #define PLogObjectParent(p,c) {((PetscObject)(c))->parent = (PetscObject) p;} 167 #define PLogObjectParents(p,n,d) {int _i; for ( _i=0; _i<n; _i++ ) \ 168 PLogObjectParent(p,(d)[_i]);} 169 #define PLogObjectCreate(h) {if (_PHC) (*_PHC)((PetscObject)h);} 170 #define PLogObjectDestroy(h) {if (_PHD) (*_PHD)((PetscObject)h);} 171 #define PLogObjectMemory(p,m) {((PetscObject)(p))->mem += (m);} 172 extern int PLogObjectState(PetscObject,char *,...); 173 extern int PLogInfo(PetscObject,char*,...); 174 175 #else 176 177 #define PLogObjectCreate(h) 178 #define PLogObjectDestroy(h) 179 #define PLogEventBegin(e,o1,o2,o3,o4) 180 #define PLogEventEnd(e,o1,o2,o3,o4) 181 #define PLogObjectParent(p,c) 182 #define PLogObjectParents(p,n,c) 183 extern int PLogInfo(PetscObject,char*,...); 184 #endif 185 186 #endif 187