:orphan: # PetscPreLoadBegin Begin a segment of code that may be preloaded (run twice) to get accurate timings ## Synopsis ``` #include void PetscPreLoadBegin(PetscBool flag,char *name); ``` Not Collective ## Input Parameters - ***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_view`) to be preloaded ## Usage ```none PetscPreLoadBegin(PETSC_TRUE,"first stage); lines of code PetscPreLoadStage("second stage"); lines of code PetscPreLoadEnd(); ``` ## Note 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 - ***PetscPreLoadIt -*** 0 for the first computation (with preloading turned off it is only 0) 1 for the second - ***PetscPreLoadMax -*** 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 `PetscPreLoadBegin()` and `PetscPreLoadEnd()` ## See Also [](ch_profiling), `PetscLogEventRegister()`, `PetscLogEventBegin()`, `PetscLogEventEnd()`, `PetscPreLoadEnd()`, `PetscPreLoadStage()` ## Level intermediate ## Location src/sys/logging/plog.c ## Examples src/ksp/ksp/tutorials/ex10.c
src/ksp/ksp/tutorials/ex27.c
src/ksp/ksp/tutorials/ex72.c
--- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/logging/plog.c) [Index of all Profiling routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)