Actual source code: logimpl.h
petsc-3.7.1 2016-05-15
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, petsc_maxActions;
     42: PETSC_EXTERN int        petsc_numObjects, petsc_maxObjects;
     43: PETSC_EXTERN int        petsc_numObjectsDestroyed;

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

     51: #ifdef PETSC_USE_LOG

     53: /* Runtime functions */
     54: PETSC_EXTERN PetscErrorCode PetscStageLogGetClassRegLog(PetscStageLog, PetscClassRegLog *);
     55: PETSC_EXTERN PetscErrorCode PetscStageLogGetEventRegLog(PetscStageLog, PetscEventRegLog *);
     56: PETSC_EXTERN PetscErrorCode PetscStageLogGetClassPerfLog(PetscStageLog, int, PetscClassPerfLog *);

     59: /* Creation and destruction functions */
     60: PETSC_EXTERN PetscErrorCode EventRegLogCreate(PetscEventRegLog *);
     61: PETSC_EXTERN PetscErrorCode EventRegLogDestroy(PetscEventRegLog);
     62: PETSC_EXTERN PetscErrorCode EventPerfLogCreate(PetscEventPerfLog *);
     63: PETSC_EXTERN PetscErrorCode EventPerfLogDestroy(PetscEventPerfLog);
     64: /* General functions */
     65: PETSC_EXTERN PetscErrorCode EventPerfLogEnsureSize(PetscEventPerfLog, int);
     66: PETSC_EXTERN PetscErrorCode EventPerfInfoClear(PetscEventPerfInfo *);
     67: PETSC_EXTERN PetscErrorCode EventPerfInfoCopy(PetscEventPerfInfo *, PetscEventPerfInfo *);
     68: /* Registration functions */
     69: PETSC_EXTERN PetscErrorCode EventRegLogRegister(PetscEventRegLog, const char [], PetscClassId, PetscLogEvent *);
     70: /* Query functions */
     71: PETSC_EXTERN PetscErrorCode EventPerfLogSetVisible(PetscEventPerfLog, PetscLogEvent, PetscBool );
     72: PETSC_EXTERN PetscErrorCode EventPerfLogGetVisible(PetscEventPerfLog, PetscLogEvent, PetscBool  *);
     73: /* Activaton functions */
     74: PETSC_EXTERN PetscErrorCode EventPerfLogActivate(PetscEventPerfLog, PetscLogEvent);
     75: PETSC_EXTERN PetscErrorCode EventPerfLogDeactivate(PetscEventPerfLog, PetscLogEvent);
     76: PETSC_EXTERN PetscErrorCode EventPerfLogActivateClass(PetscEventPerfLog, PetscEventRegLog, PetscClassId);
     77: PETSC_EXTERN PetscErrorCode EventPerfLogDeactivateClass(PetscEventPerfLog, PetscEventRegLog, PetscClassId);

     79: /* Logging functions */
     80: PETSC_EXTERN PetscErrorCode PetscLogEventBeginDefault(PetscLogEvent, int, PetscObject, PetscObject, PetscObject, PetscObject);
     81: PETSC_EXTERN PetscErrorCode PetscLogEventEndDefault(PetscLogEvent, int, PetscObject, PetscObject, PetscObject, PetscObject);
     82: PETSC_EXTERN PetscErrorCode PetscLogEventBeginComplete(PetscLogEvent, int, PetscObject, PetscObject, PetscObject, PetscObject);
     83: PETSC_EXTERN PetscErrorCode PetscLogEventEndComplete(PetscLogEvent, int, PetscObject, PetscObject, PetscObject, PetscObject);
     84: PETSC_EXTERN PetscErrorCode PetscLogEventBeginTrace(PetscLogEvent, int, PetscObject, PetscObject, PetscObject, PetscObject);
     85: PETSC_EXTERN PetscErrorCode PetscLogEventEndTrace(PetscLogEvent, int, PetscObject, PetscObject, PetscObject, PetscObject);

     87: /* Creation and destruction functions */
     88: PETSC_EXTERN PetscErrorCode PetscClassRegLogCreate(PetscClassRegLog *);
     89: PETSC_EXTERN PetscErrorCode PetscClassRegLogDestroy(PetscClassRegLog);
     90: PETSC_EXTERN PetscErrorCode ClassPerfLogCreate(PetscClassPerfLog *);
     91: PETSC_EXTERN PetscErrorCode ClassPerfLogDestroy(PetscClassPerfLog);
     92: PETSC_EXTERN PetscErrorCode PetscClassRegInfoDestroy(PetscClassRegInfo *);
     93: /* General functions */
     94: PETSC_EXTERN PetscErrorCode ClassPerfLogEnsureSize(PetscClassPerfLog, int);
     95: PETSC_EXTERN PetscErrorCode ClassPerfInfoClear(PetscClassPerfInfo *);
     96: /* Registration functions */
     97: PETSC_EXTERN PetscErrorCode PetscClassRegLogRegister(PetscClassRegLog, const char [], PetscClassId);
     98: /* Query functions */
     99: PETSC_EXTERN PetscErrorCode PetscClassRegLogGetClass(PetscClassRegLog, PetscClassId, int *);
    100: /* Logging functions */
    101: PETSC_EXTERN PetscErrorCode PetscLogObjCreateDefault(PetscObject);
    102: PETSC_EXTERN PetscErrorCode PetscLogObjDestroyDefault(PetscObject);

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

    121: PETSC_EXTERN PetscErrorCode EventRegLogGetEvent(PetscEventRegLog, const char [], PetscLogEvent *);

    124: #endif /* PETSC_USE_LOG */