timers.c
Go to the documentation of this file.
1 
11 #include <GKlib.h>
12 
13 
14 
15 
16 /*************************************************************************
17 * This function returns the CPU seconds
18 **************************************************************************/
19 double gk_WClockSeconds(void)
20 {
21 #ifdef __GNUC__
22  struct timeval ctime;
23 
24  gettimeofday(&ctime, NULL);
25 
26  return (double)ctime.tv_sec + (double).000001*ctime.tv_usec;
27 #else
28  return (double)time(NULL);
29 #endif
30 }
31 
32 
33 /*************************************************************************
34 * This function returns the CPU seconds
35 **************************************************************************/
36 double gk_CPUSeconds(void)
37 {
38 //#ifdef __OPENMP__
39 #ifdef __OPENMPXXXX__
40  return omp_get_wtime();
41 #else
42  #if defined(WIN32) || defined(__MINGW32__)
43  return((double) clock()/CLOCKS_PER_SEC);
44  #else
45  struct rusage r;
46 
47  getrusage(RUSAGE_SELF, &r);
48  return ((r.ru_utime.tv_sec + r.ru_stime.tv_sec) + 1.0e-6*(r.ru_utime.tv_usec + r.ru_stime.tv_usec));
49  #endif
50 #endif
51 }
52 
time
#define time
Definition: timeAdaptAutoDiff.cpp:31
GKlib.h
gk_WClockSeconds
double gk_WClockSeconds(void)
Definition: timers.c:19
gk_CPUSeconds
double gk_CPUSeconds(void)
Definition: timers.c:36
return
if n return
Definition: level1_cplx_impl.h:33
NULL
#define NULL
Definition: ccolamd.c:609


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:09:01