# PetscLogEventRegister

Registers an event name for logging operations in an application code.

### Synopsis

    #include "petsc.h"
    PetscErrorCode PETSC_DLLEXPORT PetscLogEventRegister(PetscEvent *event, const char name[],PetscCookie cookie)

Not Collective

### Input Parameter

| name | - The name associated with the event
| cookie | - The cookie associated to the class for this event

### Output Parameter

event -The event id for use with PetscLogEventBegin() and PetscLogEventEnd().

### Example of Usage

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

### Notes

PETSc automatically logs library events if the code has been compiled with -DPETSC_USE_LOG (which is the default) and -log, -log_summary, or -log_all are specified. PetscLogEventRegister() is intended for logging user events to supplement this PETSc information.

PETSc can gather data for use with the utilities Upshot/Nupshot (part of the MPICH distribution). If PETSc has been compiled with flag -DPETSC_HAVE_MPE (MPE is an additional utility within MPICH), the user can employ another command line option, -log_mpe, to create a logfile, "mpe.log", which can be visualized Upshot/Nupshot.

### Keywords

log, event, register

### See Also

PetscLogEventBegin(), PetscLogEventEnd(), PetscLogFlops(),
PetscLogEventMPEActivate(), PetscLogEventMPEDeactivate(), PetscLogEventActivate(), PetscLogEventDeactivate()

Level:intermediate
Location:src/sys/src/plog/plog.c
Index of all Profiling routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/sys/examples/tutorials/ex3.c.html
src/sys/examples/tutorials/ex3f.F.html
src/vec/examples/tutorials/ex5.c.html
src/ksp/examples/tutorials/ex9.c.html
src/dm/ao/examples/tutorials/ex2.c.html