:orphan: # PetscGetCPUTime Returns the CPU time in seconds used by the process. ## Synopsis ``` #include "petscsys.h" #include "petsctime.h" PetscErrorCode PetscGetCPUTime(PetscLogDouble *t) ``` Not Collective ## Output Parameter - ***t -*** Time in seconds charged to the process. ## Example ```none #include ... PetscLogDouble t1, t2; PetscCall(PetscGetCPUTime(&t1)); ... code to time ... PetscCall(PetscGetCPUTime(&t2)); printf("Code took %f CPU seconds\n", t2-t1); ``` ## Note One should use the -log_view option of PETSc for profiling. The CPU time is NOT a realistic number to use since it does not include the time for message passing etc. Also on many systems the accuracy is only on the order of microseconds. ## See Also `PetscTime()`, `PetscLogView()` ## Level intermediate ## Location src/sys/time/cputime.c --- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/time/cputime.c) [Index of all Sys routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)