PetscLogHandler#

Interface for performance logging. A log handler receives a PetscLogState that has information about the events (PetscLogEvent) and stages (PetscLogStage) in the logging environment. When a handler is connected to PETSc’s global logging stream (PetscLogHandlerStart()), it receives updates about events (PetscLogEventBegin() / PetscLogEventEnd()), stages (PetscLogStagePush() / PetscLogStagePop()), and objects (PetscLogObjectCreate() / PetscLogObjectDestroy()). After collecting information the logger can summarize its data with PetscLogHandlerView().

Synopsis#

typedef struct _p_PetscLogHandler *PetscLogHandler;

Example Usage#

#include <petscsys.h>

int main() {
  UserCtx             ctx;
  PetscLogHandlerType handler_type;

  PetscInitialize(...);
  // ... fill in ctx
  PetscLogHandlerCreate(PETSC_COMM_WORLD, &handler);
  PetscLogHandlerSetType(handler, handler_type);
  PetscLogHandlerStart(handler); // connect your handler to global logging state
  // ... run code to be profiled
  PetscLogHandlerStop(handler); // disconnect your handler from the global logging state
  PetscLogHandlerView(handler, PETSC_VIEWER_STDOUT_WORLD); // view the results
  PetscLogHandlerDestroy(&handler);
  PetscFinalize();
}

See Also#

Profiling, PetscLogHandlerCreate(), PetscLogHandlerStart(), PetscLogHandlerStop(), PetscLogHandlerSetType(), PetscLogHandlerGetType(), PetscLogHandlerSetState(), PetscLogHandlerGetState(), PetscLogHandlerEventBegin(), PetscLogHandlerEventEnd(), PetscLogHandlerEventSync(), PetscLogHandlerObjectCreate(), PetscLogHandlerObjectDestroy(), PetscLogHandlerStagePush(), PetscLogHandlerStagePop(), PetscLogHandlerView(), PetscLogHandlerDestroy(),

Level#

developer

Location#

include/petsclogtypes.h

Implementations#

_p_PetscLogHandler in include/petsc/private/loghandlerimpl.h


Index of all Profiling routines
Table of Contents for all manual pages
Index of all manual pages