PetscLogDefaultBegin — PETSc 3.25.4 documentation

Skip to main content
`Ctrl`+`K`

# PetscLogDefaultBegin

Turns on logging (profiling) of PETSc code using the default log handler (profiler). This logs time, flop rates, and object creation and should not slow programs down too much.

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscLogDefaultBegin(void)

Logically Collective on `PETSC_COMM_WORLD`

## Options Database Key

- -log_view [viewertype[:filename[:viewerformat]]] - Prints summary of flop and timing (profiling) information to the screen (for PETSc configured with `--with-log=1` (which is the default)). This option must be provided before `PetscInitialize()`.

## Example Usage

          PetscInitialize(...);
          PetscLogDefaultBegin();
           ... code ...
          PetscLogView(viewer); or PetscLogDump();
          PetscFinalize();

## Notes

`PetscLogView()` or `PetscLogDump()` actually cause the printing of the logging information.

This routine may be called more than once.

To provide the `-log_view` option in your source code you must call PetscCall(PetscOptionsSetValue(NULL, “-log_view”, NULL)); before you call `PetscInitialize()`

## See Also

Profiling, `PetscLogDump()`, `PetscLogView()`, `PetscLogTraceBegin()`

## Level

advanced

## Location

src/sys/logging/plog.c

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