1 /* $Id: plog.h,v 1.1 1995/07/12 16:28:35 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 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 petsc/include/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 $ int user_event_flops; 108 $ PLogEventRegister(USER_EVENT,"User event"); 109 $ PLogEventBegin(USER_EVENT,0,0,0,0); 110 $ [code segment to monitor] 111 $ PLogFlops(user_event_flops); 112 $ PLogEventEnd(USER_EVENT,0,0,0,0); 113 114 .seealso: PLogEventRegister(), PLogEventEnd(), PLogFlops() 115 116 .keywords: log, event, begin 117 M*/ 118 #define PLogEventBegin(e,o1,o2,o3,o4) {static int _tacky = 0;\ 119 { _tacky++;if (_PLB) (*_PLB)(e,_tacky,(PetscObject)o1,\ 120 (PetscObject)o2,(PetscObject)o3,(PetscObject)o4);}; 121 122 /*M 123 PLogEventEnd - Log the end of a user event. Note that 124 petsc/include/plog.h MUST be included in the user's code to employ 125 this function. 126 127 Input Parameters: 128 . e - integer associated with the event (69 < e < 89) 129 . o1,o2,o3,o4 - objects associated with the event, or 0 130 131 Synopsis: 132 PLogEventEnd(int e,PetscObject o1,PetscObject o2,PetscObject o3, 133 PetscObject o4) 134 135 Notes: 136 You should also register each integer event with the command 137 PLogRegisterEvent(). Source code must be compiled with 138 -DPETSC_LOG, which is the default. 139 140 PETSc automatically logs library events if the code has been 141 compiled with -DPETSC_LOG, and -log, -log_summary, or -log_all are 142 specified. PLogEventEnd() is intended for logging user events 143 to supplement this PETSc information. 144 145 Example of Usage: 146 $ #define USER_EVENT 75 147 $ int user_event_flops; 148 $ PLogEventRegister(USER_EVENT,"User event"); 149 $ PLogEventBegin(USER_EVENT,0,0,0,0); 150 $ [code segment to monitor] 151 $ PLogFlops(user_event_flops); 152 $ PLogEventEnd(USER_EVENT,0,0,0,0); 153 154 .seealso: PLogEventRegister(), PLogEventBegin(), PLogFlops() 155 156 .keywords: log, event, end 157 M*/ 158 #define PLogEventEnd(e,o1,o2,o3,o4) \ 159 { if (_PLE) (*_PLE)(e,_tacky,(PetscObject)o1,(PetscObject)o2,\ 160 (PetscObject)o3,(PetscObject)o4);} _tacky--;} 161 #define PLogObjectParent(p,c) {((PetscObject)(c))->parent = (PetscObject) p;} 162 #define PLogObjectParents(p,n,d) {int _i; for ( _i=0; _i<n; _i++ ) \ 163 PLogObjectParent(p,(d)[_i]);} 164 #define PLogObjectCreate(h) {if (_PHC) (*_PHC)((PetscObject)h);} 165 #define PLogObjectDestroy(h) {if (_PHD) (*_PHD)((PetscObject)h);} 166 extern int PLogObjectState(PetscObject,char *,...); 167 extern int PLogInfo(PetscObject,char*,...); 168 169 #else 170 171 #define PLogObjectCreate(h) 172 #define PLogObjectDestroy(h) 173 #define PLogEventBegin(e,o1,o2,o3,o4) 174 #define PLogEventEnd(e,o1,o2,o3,o4) 175 #define PLogObjectParent(p,c) 176 #define PLogObjectParents(p,n,c) 177 extern int PLogInfo(PetscObject,char*,...); 178 #endif 179 180 #endif 181