petsc-3.7.1 2016-05-15
Report Typos and Errors

PetscGetCPUTime

Returns the CPU time in seconds used by the process.

Synopsis

#include "petscsys.h" 
#include "petsctime.h" 
PetscErrorCode  PetscGetCPUTime(PetscLogDouble *t)
Not Collective Many br

Output Parameter

t -Time in seconds charged to the process. Many br

Example

    #include <petscsys.h>
    ...
    PetscLogDouble t1, t2;

    ierr = PetscGetCPUTime(&t1);CHKERRQ(ierr);
    ... code to time ...
    ierr = PetscGetCPUTime(&t2);CHKERRQ(ierr);
    printf("Code took %f CPU seconds\n", t2-t1);
Many br

Many br

Notes

One should use PetscTime() or the -log_summary option of Many brPETSc for profiling. The CPU time is NOT a realistic number to Many bruse since it does not include the time for message passing etc. Many brAlso on many systems the accuracy is only on the order of microseconds. Many br

Level:intermediate
Location:
src/sys/time/cputime.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages