Actual source code: petsclog.h
1: /*
2: Defines profile/logging in PETSc.
3: */
7: #include petsc.h
9: /*
10: Each PETSc object class has it's own cookie (internal integer in the
11: data structure used for error checking). These are all defined by an offset
12: from the lowest one, PETSC_COOKIE.
13: */
14: #define PETSC_COOKIE 1211211
16: #define PETSC_EVENT 1311311
19: /* Events for the Petsc standard library */
22: /* Global flop counter */
25: /* General logging of information; different from event logging */
26: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogInfo_Private(void*,const char[],...) PETSC_PRINTF_FORMAT_CHECK(2,3);
27: #if defined(PETSC_USE_DEBUG)
28: #define PetscLogInfo(A) PetscLogInfo_Private A
29: #else
30: #define PetscLogInfo(A) 0
31: #endif
32: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogInfoDeactivateClass(PetscCookie);
33: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogInfoActivateClass(PetscCookie);
36: #if defined(PETSC_USE_LOG) /* --- Logging is turned on --------------------------------*/
38: /*
39: Flop counting: We count each arithmetic operation (e.g., addition, multiplication) separately.
41: For the complex numbers version, note that
42: 1 complex addition = 2 flops
43: 1 complex multiplication = 6 flops,
44: where we define 1 flop as that for a double precision scalar. We roughly approximate
45: flop counting for complex numbers by multiplying the total flops by 4; this corresponds
46: to the assumption that we're counting mostly additions and multiplications -- and
47: roughly the same number of each. More accurate counting could be done by distinguishing
48: among the various arithmetic operations.
49: */
51: #if defined(PETSC_USE_COMPLEX)
52: #define PetscLogFlops(n) (_TotalFlops += (4*n),0)
53: #else
54: #define PetscLogFlops(n) (_TotalFlops += (n),0)
55: #endif
57: #if defined (PETSC_HAVE_MPE)
58: #include "mpe.h"
59: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogMPEBegin(void);
60: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogMPEDump(const char[]);
62: #define PETSC_LOG_EVENT_MPE_BEGIN(e) \
63: ((UseMPE && _stageLog->stageInfo[_stageLog->curStage].eventLog->eventInfo[e].active) ? \
64: MPE_Log_event(_stageLog->eventLog->eventInfo[e].mpe_id_begin,0,(char*)"") : 0)
66: #define PETSC_LOG_EVENT_MPE_END(e) \
67: ((UseMPE && _stageLog->stageInfo[_stageLog->curStage].eventLog->eventInfo[e].active) ? \
68: MPE_Log_event(_stageLog->eventLog->eventInfo[e].mpe_id_end,0,(char*)"") : 0)
70: #else
71: #define PETSC_LOG_EVENT_MPE_BEGIN(e) 0
72: #define PETSC_LOG_EVENT_MPE_END(e) 0
73: #endif
75: EXTERN PETSC_DLLEXPORT PetscErrorCode (*_PetscLogPLB)(PetscEvent,int,PetscObject,PetscObject,PetscObject,PetscObject);
76: EXTERN PETSC_DLLEXPORT PetscErrorCode (*_PetscLogPLE)(PetscEvent,int,PetscObject,PetscObject,PetscObject,PetscObject);
77: EXTERN PETSC_DLLEXPORT PetscErrorCode (*_PetscLogPHC)(PetscObject);
78: EXTERN PETSC_DLLEXPORT PetscErrorCode (*_PetscLogPHD)(PetscObject);
80: #define PetscLogObjectParent(p,c) \
81: ((c && p) ? ((PetscObject)(c))->parent = (PetscObject)(p),((PetscObject)(c))->parentid = ((PetscObject)p)->id : 0, 0)
83: #define PetscLogObjectParents(p,n,d) 0;{int _i; for (_i=0; _i<n; _i++) {PetscLogObjectParent(p,(d)[_i]);}}
84: #define PetscLogObjectCreate(h) ((_PetscLogPHC) ? (*_PetscLogPHC)((PetscObject)h) : 0)
85: #define PetscLogObjectDestroy(h) ((_PetscLogPHD) ? (*_PetscLogPHD)((PetscObject)h) : 0)
86: #define PetscLogObjectMemory(p,m) (((PetscObject)(p))->mem += (m),0)
87: /* Initialization functions */
88: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogBegin(void);
89: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogAllBegin(void);
90: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogTraceBegin(FILE *);
91: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogActions(PetscTruth);
92: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogObjects(PetscTruth);
93: /* General functions */
94: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogGetRGBColor(const char*[]);
95: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogDestroy(void);
96: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogSet(PetscErrorCode (*)(int, int, PetscObject, PetscObject, PetscObject, PetscObject),
97: PetscErrorCode (*)(int, int, PetscObject, PetscObject, PetscObject, PetscObject));
98: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogObjectState(PetscObject, const char[], ...) PETSC_PRINTF_FORMAT_CHECK(2,3);
99: /* Output functions */
100: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogPrintSummary(MPI_Comm, const char[]);
101: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogDump(const char[]);
102: /* Counter functions */
103: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscGetFlops(PetscLogDouble *);
104: /* Stage functions */
105: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogStageRegister(int*, const char[]);
106: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogStagePush(int);
107: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogStagePop(void);
108: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogStageSetActive(int, PetscTruth);
109: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogStageGetActive(int, PetscTruth *);
110: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogStageSetVisible(int, PetscTruth);
111: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogStageGetVisible(int, PetscTruth *);
112: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogStageGetId(const char [], int *);
113: /* Event functions */
114: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogEventRegister(PetscEvent*, const char[], PetscCookie);
115: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogEventActivate(PetscEvent);
116: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogEventDeactivate(PetscEvent);
117: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogEventSetActiveAll(PetscEvent, PetscTruth);
118: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogEventActivateClass(PetscCookie);
119: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogEventDeactivateClass(PetscCookie);
120: /* Class functions */
121: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogClassRegister(PetscCookie*, const char []);
123: /* Global counters */
140: /* We must make these structures available if we are to access the event
141: activation flags in the PetscLogEventBegin/End() macros. If we forced a
142: function call each time, we could leave these structures in plog.h
143: */
144: /* Default log */
145: typedef struct _StageLog *StageLog;
148: /* A simple stack (should replace) */
149: typedef struct _IntStack *IntStack;
151: /* The structures for logging performance */
152: typedef struct _EventPerfInfo {
153: int id; /* The integer identifying this section */
154: PetscTruth active; /* The flag to activate logging */
155: PetscTruth visible; /* The flag to print info in summary */
156: int depth; /* The nesting depth of the event call */
157: int count; /* The number of times this section was executed */
158: PetscLogDouble flops; /* The flops used in this section */
159: PetscLogDouble time; /* The time taken for this section */
160: PetscLogDouble numMessages; /* The number of messages in this section */
161: PetscLogDouble messageLength; /* The total message lengths in this section */
162: PetscLogDouble numReductions; /* The number of reductions in this section */
163: } EventPerfInfo;
165: typedef struct _ClassPerfInfo {
166: int id; /* The integer identifying this class */
167: int creations; /* The number of objects of this class created */
168: int destructions; /* The number of objects of this class destroyed */
169: PetscLogDouble mem; /* The total memory allocated by objects of this class */
170: PetscLogDouble descMem; /* The total memory allocated by descendents of these objects */
171: } ClassPerfInfo;
173: /* The structures for logging registration */
174: typedef struct _ClassRegInfo {
175: char *name; /* The class name */
176: PetscCookie cookie; /* The integer identifying this class */
177: } ClassRegInfo;
179: typedef struct _EventRegInfo {
180: char *name; /* The name of this event */
181: PetscCookie cookie; /* The class id for this event (should maybe give class ID instead) */
182: #if defined (PETSC_HAVE_MPE)
183: int mpe_id_begin; /* MPE IDs that define the event */
184: int mpe_id_end;
185: #endif
186: } EventRegInfo;
188: typedef struct _EventRegLog *EventRegLog;
189: struct _EventRegLog {
190: int numEvents; /* The number of registered events */
191: int maxEvents; /* The maximum number of events */
192: EventRegInfo *eventInfo; /* The registration information for each event */
193: };
195: typedef struct _EventPerfLog *EventPerfLog;
196: struct _EventPerfLog {
197: int numEvents; /* The number of logging events */
198: int maxEvents; /* The maximum number of events */
199: EventPerfInfo *eventInfo; /* The performance information for each event */
200: };
202: /* The structure for logging class information */
203: typedef struct _ClassRegLog *ClassRegLog;
204: struct _ClassRegLog {
205: int numClasses; /* The number of classes registered */
206: int maxClasses; /* The maximum number of classes */
207: ClassRegInfo *classInfo; /* The structure for class information (cookies are monotonicly increasing) */
208: };
210: typedef struct _ClassPerfLog *ClassPerfLog;
211: struct _ClassPerfLog {
212: int numClasses; /* The number of logging classes */
213: int maxClasses; /* The maximum number of classes */
214: ClassPerfInfo *classInfo; /* The structure for class information (cookies are monotonicly increasing) */
215: };
217: /* The structures for logging in stages */
218: typedef struct _StageInfo {
219: char *name; /* The stage name */
220: PetscTruth used; /* The stage was pushed on this processor */
221: EventPerfInfo perfInfo; /* The stage performance information */
222: EventPerfLog eventLog; /* The event information for this stage */
223: ClassPerfLog classLog; /* The class information for this stage */
224: } StageInfo;
226: struct _StageLog {
227: /* Size information */
228: int numStages; /* The number of registered stages */
229: int maxStages; /* The maximum number of stages */
230: /* Runtime information */
231: IntStack stack; /* The stack for active stages */
232: int curStage; /* The current stage (only used in macros so we don't call StackTop) */
233: /* Stage specific information */
234: StageInfo *stageInfo; /* The information for each stage */
235: EventRegLog eventLog; /* The registered events */
236: ClassRegLog classLog; /* The registered classes */
237: };
239: #define PetscLogEventBarrierBegin(e,o1,o2,o3,o4,cm) \
240: (((_PetscLogPLB && _stageLog->stageInfo[_stageLog->curStage].perfInfo.active && _stageLog->stageInfo[_stageLog->curStage].eventLog->eventInfo[e].active) ? \
241: (PetscLogEventBegin((e),o1,o2,o3,o4) || MPI_Barrier(cm) || PetscLogEventEnd((e),o1,o2,o3,o4)) : 0 ) || \
242: PetscLogEventBegin((e)+1,o1,o2,o3,o4))
244: #define PetscLogEventBegin(e,o1,o2,o3,o4) \
245: (((_PetscLogPLB && _stageLog->stageInfo[_stageLog->curStage].perfInfo.active && _stageLog->stageInfo[_stageLog->curStage].eventLog->eventInfo[e].active) ? \
246: (*_PetscLogPLB)((e),0,(PetscObject)(o1),(PetscObject)(o2),(PetscObject)(o3),(PetscObject)(o4)) : 0 ) || \
247: PETSC_LOG_EVENT_MPE_BEGIN(e))
249: #define PetscLogEventBarrierEnd(e,o1,o2,o3,o4,cm) PetscLogEventEnd(e+1,o1,o2,o3,o4)
251: #define PetscLogEventEnd(e,o1,o2,o3,o4) \
252: (((_PetscLogPLE && _stageLog->stageInfo[_stageLog->curStage].perfInfo.active && _stageLog->stageInfo[_stageLog->curStage].eventLog->eventInfo[e].active) ? \
253: (*_PetscLogPLE)((e),0,(PetscObject)(o1),(PetscObject)(o2),(PetscObject)(o3),(PetscObject)(o4)) : 0 ) || \
254: PETSC_LOG_EVENT_MPE_END(e))
256: /* Creation and destruction functions */
257: EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogCreate(StageLog *);
258: EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogDestroy(StageLog);
259: /* Registration functions */
260: EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogRegister(StageLog, const char [], int *);
261: /* Runtime functions */
262: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogGetStageLog(StageLog *);
263: EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogPush(StageLog, int);
264: EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogPop(StageLog);
265: EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogGetCurrent(StageLog, int *);
266: EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogSetActive(StageLog, int, PetscTruth);
267: EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogGetActive(StageLog, int, PetscTruth *);
268: EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogSetVisible(StageLog, int, PetscTruth);
269: EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogGetVisible(StageLog, int, PetscTruth *);
270: EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogGetStage(StageLog, const char [], int *);
271: EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogGetClassRegLog(StageLog, ClassRegLog *);
272: EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogGetEventRegLog(StageLog, EventRegLog *);
273: EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogGetClassPerfLog(StageLog, int, ClassPerfLog *);
274: EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogGetEventPerfLog(StageLog, int, EventPerfLog *);
276: /*
277: This does not work for MPI-Uni because our include/mpiuni/mpi.h file
278: uses macros to defined the MPI operations.
280: It does not work correctly from HP-UX because it processes the
281: macros in a way that sometimes it double counts, hence
282: PETSC_HAVE_BROKEN_RECURSIVE_MACRO
284: It does not work with Windows because winmpich lacks MPI_Type_size()
285: */
286: #if !defined(_petsc_mpi_uni) && !defined(PETSC_HAVE_BROKEN_RECURSIVE_MACRO) && !defined (PETSC_HAVE_MPI_MISSING_TYPESIZE)
287: /*
288: Logging of MPI activities
289: */
290: #define TypeSize(buff,count,type) \
291: (MPI_Type_size(type,&PETSC_DUMMY_SIZE) || (buff += (PetscLogDouble) ((count)*PETSC_DUMMY_SIZE),0))
293: #define MPI_Irecv(buf,count,datatype,source,tag,comm,request) \
294: ((PETSC_DUMMY_COUNT = count,irecv_ct++,0) || TypeSize(irecv_len,PETSC_DUMMY_COUNT,datatype) || MPI_Irecv(buf,PETSC_DUMMY_COUNT,datatype,source,tag,comm,request))
296: #define MPI_Isend(buf,count,datatype,dest,tag,comm,request) \
297: ((PETSC_DUMMY_COUNT = count,isend_ct++,0) || TypeSize(isend_len,PETSC_DUMMY_COUNT,datatype) || MPI_Isend(buf,PETSC_DUMMY_COUNT,datatype,dest,tag,comm,request))
299: #define MPI_Startall_irecv(count,number,requests) \
300: ((irecv_ct += (PetscLogDouble)(number),0) || TypeSize(irecv_len,count,MPIU_SCALAR) || MPI_Startall(number,requests))
302: #define MPI_Startall_isend(count,number,requests) \
303: ((isend_ct += (PetscLogDouble)(number),0) || TypeSize(isend_len,count,MPIU_SCALAR) || MPI_Startall(number,requests))
305: #define MPI_Start_isend(count,requests) \
306: ((isend_ct++,0) || TypeSize(isend_len,count,MPIU_SCALAR) || MPI_Start(requests))
308: #define MPI_Recv(buf,count,datatype,source,tag,comm,status) \
309: ((PETSC_DUMMY_COUNT = count,recv_ct++,0) || TypeSize(recv_len,PETSC_DUMMY_COUNT,datatype) || MPI_Recv(buf,PETSC_DUMMY_COUNT,datatype,source,tag,comm,status))
311: #define MPI_Send(buf,count,datatype,dest,tag,comm) \
312: ((PETSC_DUMMY_COUNT = count,send_ct++,0) || TypeSize(send_len,PETSC_DUMMY_COUNT,datatype) || MPI_Send(buf,PETSC_DUMMY_COUNT,datatype,dest,tag,comm))
314: #define MPI_Wait(request,status) \
315: ((wait_ct++,sum_of_waits_ct++,0) || MPI_Wait(request,status))
316:
317: #define MPI_Waitany(a,b,c,d) \
318: ((wait_any_ct++,sum_of_waits_ct++,0) || MPI_Waitany(a,b,c,d))
320: #define MPI_Waitall(count,array_of_requests,array_of_statuses) \
321: ((PETSC_DUMMY_COUNT = count,wait_all_ct++,sum_of_waits_ct += (PetscLogDouble) (PETSC_DUMMY_COUNT),0) || MPI_Waitall(PETSC_DUMMY_COUNT,array_of_requests,array_of_statuses))
322:
323: #define MPI_Allreduce(sendbuf,recvbuf,count,datatype,op,comm) \
324: ((allreduce_ct++,0) || MPI_Allreduce(sendbuf,recvbuf,count,datatype,op,comm))
326: #else
328: #define MPI_Startall_irecv(count,number,requests) \
329: (MPI_Startall(number,requests))
331: #define MPI_Startall_isend(count,number,requests) \
332: (MPI_Startall(number,requests))
334: #define MPI_Start_isend(count,requests) \
335: (MPI_Start(requests))
337: #endif /* !_petsc_mpi_uni && ! PETSC_HAVE_BROKEN_RECURSIVE_MACRO */
339: #else /* ---Logging is turned off --------------------------------------------*/
341: #define PetscLogFlops(n) 0
343: /*
344: With logging turned off, then MPE has to be turned off
345: */
346: #define PetscLogMPEBegin() 0
347: #define PetscLogMPEDump(a) 0
349: #define PetscLogEventActivate(a) 0
350: #define PetscLogEventDeactivate(a) 0
352: #define PetscLogEventActivateClass(a) 0
353: #define PetscLogEventDeactivateClass(a) 0
355: #define _PetscLogPLB 0
356: #define _PetscLogPLE 0
357: #define _PetscLogPHC 0
358: #define _PetscLogPHD 0
359: #define PetscGetFlops(a) (*(a) = 0.0,0)
360: #define PetscLogEventBegin(e,o1,o2,o3,o4) 0
361: #define PetscLogEventEnd(e,o1,o2,o3,o4) 0
362: #define PetscLogEventBarrierBegin(e,o1,o2,o3,o4,cm) 0
363: #define PetscLogEventBarrierEnd(e,o1,o2,o3,o4,cm) 0
364: #define PetscLogObjectParent(p,c) 0
365: #define PetscLogObjectParents(p,n,c) 0
366: #define PetscLogObjectCreate(h) 0
367: #define PetscLogObjectDestroy(h) 0
368: #define PetscLogObjectMemory(p,m) 0
369: #define PetscLogDestroy() 0
370: #define PetscLogStagePush(a) 0
371: #define PetscLogStagePop() 0
372: #define PetscLogStageRegister(a,b) 0
373: #define PetscLogStagePrint(a,flg) 0
374: #define PetscLogPrintSummary(comm,file) 0
375: #define PetscLogBegin() 0
376: #define PetscLogTraceBegin(file) 0
377: #define PetscLogSet(lb,le) 0
378: #define PetscLogAllBegin() 0
379: #define PetscLogDump(c) 0
380: #define PetscLogEventRegister(a,b,c) 0
381: #define PetscLogObjects(a) 0
382: #define PetscLogActions(a) 0
383: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogObjectState(PetscObject,const char[],...) PETSC_PRINTF_FORMAT_CHECK(2,3);
385: /* If PETSC_USE_LOG is NOT defined, these still need to be! */
386: #define MPI_Startall_irecv(count,number,requests) MPI_Startall(number,requests)
387: #define MPI_Startall_isend(count,number,requests) MPI_Startall(number,requests)
388: #define MPI_Start_isend(count,requests) MPI_Start(requests)
390: /* Creation and destruction functions */
391: #define StageLogCreate(stageLog) 0
392: #define StageLogDestroy(stageLog) 0
393: /* Registration functions */
394: #define StageLogRegister(stageLog, name, stage) 0
395: /* Runtime functions */
396: #define PetscLogGetStageLog(stageLog) 0
397: #define StageLogPush(stageLog, stage) 0
398: #define StageLogPop(stageLog) 0
399: #define StageLogGetCurrent(stageLog, stage) 0
400: #define StageLogSetActive(stageLog, stage, active) 0
401: #define StageLogGetActive(stageLog, stage, active) 0
402: #define StageLogSetVisible(stageLog, stage, visible) 0
403: #define StageLogGetVisible(stageLog, stage, visible) 0
404: #define StageLogGetStage(stageLog, name, stage) 0
406: #endif /* PETSC_USE_LOG */
411: #define PreLoadBegin(flag,name) \
412: {\
413: PetscTruth PreLoading = flag;\
414: int PreLoadMax,PreLoadIt,_stageNum,_3_ierr;\
415: _3_PetscOptionsGetTruth(PETSC_NULL,"-preload",&PreLoading,PETSC_NULL);CHKERRQ(_3_ierr);\
416: PreLoadMax = (int)(PreLoading);\
417: PetscPreLoadingUsed = PreLoading ? PETSC_TRUE : PetscPreLoadingUsed;\
418: for (PreLoadIt=0; PreLoadIt<=PreLoadMax; PreLoadIt++) {\
419: PetscPreLoadingOn = PreLoading;\
420: _3_PetscBarrier(PETSC_NULL);CHKERRQ(_3_ierr);\
421: if (PreLoadIt>0) {\
422: _3_PetscLogStageGetId(name,&_stageNum);CHKERRQ(_3_ierr);\
423: } else {\
424: _3_PetscLogStageRegister(&_stageNum,name);CHKERRQ(_3_ierr);\
425: }\
426: _3_PetscLogStageSetActive(_stageNum,(PetscTruth)(!PreLoadMax || PreLoadIt));\
427: _3_PetscLogStagePush(_stageNum);CHKERRQ(_3_ierr);
429: #define PreLoadEnd() \
430: _3_PetscLogStagePop();CHKERRQ(_3_ierr);\
431: PreLoading = PETSC_FALSE;\
432: }\
433: }
435: #define PreLoadStage(name) \
436: _3_PetscLogStagePop();CHKERRQ(_3_ierr);\
437: if (PreLoadIt>0) {\
438: _3_PetscLogStageGetId(name,&_stageNum);CHKERRQ(_3_ierr);\
439: } else {\
440: _3_PetscLogStageRegister(&_stageNum,name);CHKERRQ(_3_ierr);\
441: }\
442: _3_PetscLogStageSetActive(_stageNum,(PetscTruth)(!PreLoadMax || PreLoadIt));\
443: _3_PetscLogStagePush(_stageNum);CHKERRQ(_3_ierr);
446: #endif