Actual source code: logimpl.h

petsc-3.9.4 2018-09-11
Report Typos and Errors
  1:  #include <petsc/private/petscimpl.h>
  2:  #include <petsctime.h>

  4: /* A simple stack */
  5: struct _n_PetscIntStack {
  6:   int  top;   /* The top of the stack */
  7:   int  max;   /* The maximum stack size */
  8:   int *stack; /* The storage */
  9: };

 11: /* The structure for action logging */
 12: #define CREATE      0
 13: #define DESTROY     1
 14: #define ACTIONBEGIN 2
 15: #define ACTIONEND   3
 16: typedef struct _Action {
 17:   int            action;        /* The type of execution */
 18:   PetscLogEvent  event;         /* The event number */
 19:   PetscClassId   classid;        /* The event class id */
 20:   PetscLogDouble time;          /* The time of occurence */
 21:   PetscLogDouble flops;         /* The cumlative flops */
 22:   PetscLogDouble mem;           /* The current memory usage */
 23:   PetscLogDouble maxmem;        /* The maximum memory usage */
 24:   int            id1, id2, id3; /* The ids of associated objects */
 25: } Action;

 27: /* The structure for object logging */
 28: typedef struct _Object {
 29:   PetscObject    obj;      /* The associated PetscObject */
 30:   int            parent;   /* The parent id */
 31:   PetscLogDouble mem;      /* The memory associated with the object */
 32:   char           name[64]; /* The object name */
 33:   char           info[64]; /* The information string */
 34: } Object;

 36: /* Action and object logging variables */
 37: PETSC_EXTERN Action    *petsc_actions;
 38: PETSC_EXTERN Object    *petsc_objects;
 39: PETSC_EXTERN PetscBool petsc_logActions;
 40: PETSC_EXTERN PetscBool petsc_logObjects;
 41: PETSC_EXTERN int        petsc_numActions;
 42: PETSC_EXTERN int        petsc_maxActions;
 43: PETSC_EXTERN int        petsc_numObjects;
 44: PETSC_EXTERN int        petsc_maxObjects;
 45: PETSC_EXTERN int        petsc_numObjectsDestroyed;

 47: PETSC_EXTERN FILE          *petsc_tracefile;
 48: PETSC_EXTERN int            petsc_tracelevel;
 49: PETSC_EXTERN const char    *petsc_traceblanks;
 50: PETSC_EXTERN char           petsc_tracespace[128];
 51: PETSC_EXTERN PetscLogDouble petsc_tracetime;

 53: #ifdef PETSC_USE_LOG

 55: /* Creation and destruction functions */
 56: PETSC_EXTERN PetscErrorCode PetscEventRegLogCreate(PetscEventRegLog *);
 57: PETSC_EXTERN PetscErrorCode PetscEventRegLogDestroy(PetscEventRegLog);
 58: PETSC_EXTERN PetscErrorCode PetscEventPerfLogCreate(PetscEventPerfLog *);
 59: PETSC_EXTERN PetscErrorCode PetscEventPerfLogDestroy(PetscEventPerfLog);
 60: /* General functions */
 61: PETSC_EXTERN PetscErrorCode PetscEventPerfLogEnsureSize(PetscEventPerfLog, int);
 62: PETSC_EXTERN PetscErrorCode PetscEventPerfInfoClear(PetscEventPerfInfo *);
 63: PETSC_EXTERN PetscErrorCode PetscEventPerfInfoCopy(PetscEventPerfInfo *, PetscEventPerfInfo *);
 64: /* Registration functions */
 65: PETSC_EXTERN PetscErrorCode PetscEventRegLogRegister(PetscEventRegLog, const char [], PetscClassId, PetscLogEvent *);
 66: /* Query functions */
 67: PETSC_EXTERN PetscErrorCode PetscEventPerfLogSetVisible(PetscEventPerfLog, PetscLogEvent, PetscBool );
 68: PETSC_EXTERN PetscErrorCode PetscEventPerfLogGetVisible(PetscEventPerfLog, PetscLogEvent, PetscBool  *);
 69: /* Activaton functions */
 70: PETSC_EXTERN PetscErrorCode PetscEventPerfLogActivate(PetscEventPerfLog, PetscLogEvent);
 71: PETSC_EXTERN PetscErrorCode PetscEventPerfLogDeactivate(PetscEventPerfLog, PetscLogEvent);
 72: PETSC_EXTERN PetscErrorCode PetscEventPerfLogActivateClass(PetscEventPerfLog, PetscEventRegLog, PetscClassId);
 73: PETSC_EXTERN PetscErrorCode PetscEventPerfLogDeactivateClass(PetscEventPerfLog, PetscEventRegLog, PetscClassId);

 75: /* Logging functions */
 76: PETSC_EXTERN PetscErrorCode PetscLogEventBeginDefault(PetscLogEvent, int, PetscObject, PetscObject, PetscObject, PetscObject);
 77: PETSC_EXTERN PetscErrorCode PetscLogEventEndDefault(PetscLogEvent, int, PetscObject, PetscObject, PetscObject, PetscObject);
 78: PETSC_EXTERN PetscErrorCode PetscLogEventBeginComplete(PetscLogEvent, int, PetscObject, PetscObject, PetscObject, PetscObject);
 79: PETSC_EXTERN PetscErrorCode PetscLogEventEndComplete(PetscLogEvent, int, PetscObject, PetscObject, PetscObject, PetscObject);
 80: PETSC_EXTERN PetscErrorCode PetscLogEventBeginTrace(PetscLogEvent, int, PetscObject, PetscObject, PetscObject, PetscObject);
 81: PETSC_EXTERN PetscErrorCode PetscLogEventEndTrace(PetscLogEvent, int, PetscObject, PetscObject, PetscObject, PetscObject);

 83: /* Creation and destruction functions */
 84: PETSC_EXTERN PetscErrorCode PetscClassRegLogCreate(PetscClassRegLog *);
 85: PETSC_EXTERN PetscErrorCode PetscClassRegLogDestroy(PetscClassRegLog);
 86: PETSC_EXTERN PetscErrorCode PetscClassPerfLogCreate(PetscClassPerfLog *);
 87: PETSC_EXTERN PetscErrorCode PetscClassPerfLogDestroy(PetscClassPerfLog);
 88: PETSC_EXTERN PetscErrorCode PetscClassRegInfoDestroy(PetscClassRegInfo *);
 89: /* General functions */
 90: PETSC_EXTERN PetscErrorCode PetscClassPerfLogEnsureSize(PetscClassPerfLog, int);
 91: PETSC_EXTERN PetscErrorCode PetscClassPerfInfoClear(PetscClassPerfInfo *);
 92: /* Registration functions */
 93: PETSC_EXTERN PetscErrorCode PetscClassRegLogRegister(PetscClassRegLog, const char [], PetscClassId);
 94: /* Query functions */
 95: PETSC_EXTERN PetscErrorCode PetscClassRegLogGetClass(PetscClassRegLog, PetscClassId, int *);
 96: /* Logging functions */
 97: PETSC_EXTERN PetscErrorCode PetscLogObjCreateDefault(PetscObject);
 98: PETSC_EXTERN PetscErrorCode PetscLogObjDestroyDefault(PetscObject);

100: /* Creation and destruction functions */
101: PETSC_EXTERN PetscErrorCode PetscStageLogCreate(PetscStageLog *);
102: PETSC_EXTERN PetscErrorCode PetscStageLogDestroy(PetscStageLog);
103: /* Registration functions */
104: PETSC_EXTERN PetscErrorCode PetscStageLogRegister(PetscStageLog, const char [], int *);
105: /* Runtime functions */
106: PETSC_EXTERN PetscErrorCode PetscStageLogPush(PetscStageLog, int);
107: PETSC_EXTERN PetscErrorCode PetscStageLogPop(PetscStageLog);
108: PETSC_EXTERN PetscErrorCode PetscStageLogSetActive(PetscStageLog, int, PetscBool );
109: PETSC_EXTERN PetscErrorCode PetscStageLogGetActive(PetscStageLog, int, PetscBool  *);
110: PETSC_EXTERN PetscErrorCode PetscStageLogSetVisible(PetscStageLog, int, PetscBool );
111: PETSC_EXTERN PetscErrorCode PetscStageLogGetVisible(PetscStageLog, int, PetscBool  *);
112: PETSC_EXTERN PetscErrorCode PetscStageLogGetStage(PetscStageLog, const char [], PetscLogStage *);
113: PETSC_EXTERN PetscErrorCode PetscStageLogGetClassRegLog(PetscStageLog, PetscClassRegLog *);
114: PETSC_EXTERN PetscErrorCode PetscStageLogGetEventRegLog(PetscStageLog, PetscEventRegLog *);
115: PETSC_EXTERN PetscErrorCode PetscStageLogGetClassPerfLog(PetscStageLog, int, PetscClassPerfLog *);

117: PETSC_EXTERN PetscErrorCode PetscEventRegLogGetEvent(PetscEventRegLog, const char [], PetscLogEvent *);

119: PETSC_INTERN PetscErrorCode PetscLogView_Nested(PetscViewer);
120: PETSC_INTERN PetscErrorCode PetscLogNestedEnd(void);

122: #endif /* PETSC_USE_LOG */