# PreLoadBegin

Begin a segment of code that may be preloaded (run twice) to get accurate timings

### Input Parameter

| flag | - PETSC_TRUE to run twice, PETSC_FALSE to run once, may be overridden with command line option -preload true or -preload false
| name | - name of first stage (lines of code timed separately with -log_summary) to be preloaded

### Synopsis

    void PreLoadBegin(PetscTruth flag,char *name);

### Usage

         PreLoadBegin(PETSC_TRUE,"first stage);
           lines of code
           PreLoadStage("second stage");
           lines of code
         PreLoadEnd();

Notes: Only works in C/C++, not Fortran

Flags available within the macro.

| PetscPreLoadingUsed | - true if we are or have done preloading
| PetscPreLoadingOn | - true if it is CURRENTLY doing preload
| PreLoadIt | - 0 for the first computation (with preloading turned off it is only 0) 1 for the second
| PreLoadMax | - number of times it will do the computation, only one when preloading is turned on The first two variables are available throughout the program, the second two only between the PreLoadBegin() and PreLoadEnd()

### See Also

PetscLogEventRegister(), PetscLogEventBegin(), PetscLogEventEnd(), PreLoadEnd(), PreLoadStage()

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

### Examples

src/mat/examples/tutorials/ex1.c.html
src/ksp/ksp/examples/tutorials/ex10.c.html
src/ksp/ksp/examples/tutorials/ex27.c.html
src/snes/examples/tutorials/ex18.c.html
src/snes/examples/tutorials/ex19.c.html
src/snes/examples/tutorials/ex20.c.html
src/snes/examples/tutorials/ex25.c.html
src/snes/examples/tutorials/ex27.c.html
src/snes/examples/tutorials/ex29.c.html
src/snes/examples/tutorials/ex31.c.html