Skip to main content
`Ctrl`+`K`

# PetscLogEventBegin

Logs the beginning of a user event.

## Synopsis

    #include <petsclog.h>
    PetscErrorCode PetscLogEventBegin(PetscLogEvent e, PetscObject o1, PetscObject o2, PetscObject o3, PetscObject o4)

Not Collective

## Input Parameters

- e - `PetscLogEvent` obtained from `PetscLogEventRegister()`

- o1 - object associated with the event, or `NULL`

- o2 - object associated with the event, or `NULL`

- o3 - object associated with the event, or `NULL`

- o4 - object associated with the event, or `NULL`

## Fortran Synopsis

void PetscLogEventBegin(int e, PetscErrorCode ierr)

## Example Usage

      PetscLogEvent USER_EVENT;

      PetscLogDouble user_event_flops;
      PetscLogEventRegister("User event",0, &USER_EVENT);
      PetscLogEventBegin(USER_EVENT, 0, 0, 0, 0);
      [code segment to monitor]
      PetscLogFlops(user_event_flops);
      PetscLogEventEnd(USER_EVENT, 0, 0, 0, 0);

## Developer Note

`PetscLogEventBegin()` and `PetscLogEventBegin()` return error codes instead of explicitly handling the errors that occur in the macro directly because other packages that use this macros have used them in their own functions or methods that do not return error codes and it would be disruptive to change the current behavior.

## See Also

Profiling, `PetscLogEventRegister()`, `PetscLogEventEnd()`, `PetscLogFlops()`

## Level

intermediate

## Location

src/sys/logging/plog.c

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