PetscGetCPUTime

Returns the CPU time in seconds used by the process.

Synopsis

int PetscGetCPUTime(PLogDouble *t)
Not Collective

Output Parameter

t -Time in seconds charged to the process.

Example

    #include "petsc.h"
    ...
    PLogDouble t1, t2;
 
    ierr = PetscGetCPUTime(&t1); CHKERRA(ierr);
    ... code to time ...
    ierr = PetscGetCPUTime(&t2); CHKERRA(ierr);
    printf( "Code took %f CPU seconds\n", t2-t1);

Notes

One should use PetscGetTime() or the -log_summary option ofPETSc for profiling. The CPU time is not a realistic number touse since it does not include the time for message passing etc. Also on many systems the accuracy is only on the order of microseconds.

Location: src/sys/src/timecputime.c
System Index
Table of Contents