1 |
cnh |
1.5 |
/* |
2 |
|
|
//BOP |
3 |
|
|
// !ROUTINE: cloc |
4 |
|
|
// !INTERFACE: |
5 |
|
|
cloc( double *curtim ) |
6 |
|
|
*/ |
7 |
adcroft |
1.4 |
#ifdef TARGET_LINUX |
8 |
|
|
#undef FORTRAN_MANGLE_TRAILING_UNDERSCORE |
9 |
|
|
#else |
10 |
cnh |
1.3 |
#define FORTRAN_MANGLE_TRAILING_UNDERSCORE |
11 |
adcroft |
1.4 |
#endif |
12 |
cnh |
1.3 |
#define TIM_USES_GETTIMEOFDAY |
13 |
|
|
|
14 |
|
|
#ifdef FORTRAN_MANGLE_TRAILING_UNDERSCORE |
15 |
|
|
#define procedure_cloc cloc_ |
16 |
adcroft |
1.4 |
#else |
17 |
|
|
#define procedure_cloc cloc |
18 |
cnh |
1.3 |
#endif |
19 |
cnh |
1.5 |
/* |
20 |
|
|
// !DESCRIPTION: |
21 |
|
|
// *======================================================* |
22 |
|
|
// | cloc( double* timeinsec) |
23 |
|
|
// *======================================================* |
24 |
|
|
// | Call system time routines and return elapsed time |
25 |
|
|
// | in seconds as a 64-bit float. |
26 |
|
|
// *======================================================* |
27 |
|
|
//EOP |
28 |
|
|
*/ |
29 |
cnh |
1.3 |
#ifdef TIM_USES_OSF_GETCLOCK |
30 |
cnh |
1.2 |
#include <stdio.h> |
31 |
|
|
#include <stdlib.h> |
32 |
|
|
#include <unistd.h> |
33 |
|
|
#include <assert.h> |
34 |
|
|
#include <sys/time.h> |
35 |
cnh |
1.3 |
void procedure_cloc ( double *curtim ) |
36 |
cnh |
1.2 |
{ |
37 |
|
|
struct timespec tv1; |
38 |
|
|
getclock(TIMEOFDAY, &tv1); |
39 |
|
|
*curtim = (double)((tv1.tv_nsec)+(tv1.tv_sec)*1.E9); |
40 |
|
|
*curtim = *curtim/1E9; |
41 |
|
|
} |
42 |
cnh |
1.3 |
#endif |
43 |
|
|
#ifdef TIM_USES_GETTIMEOFDAY |
44 |
|
|
#include <stdio.h> |
45 |
|
|
#include <stdlib.h> |
46 |
|
|
#include <unistd.h> |
47 |
|
|
#include <assert.h> |
48 |
|
|
#include <sys/time.h> |
49 |
|
|
void procedure_cloc ( double *curtim ) |
50 |
|
|
{ |
51 |
|
|
struct timeval tv1; |
52 |
|
|
gettimeofday(&tv1 , (void *)NULL ); |
53 |
|
|
*curtim = (double)((tv1.tv_usec)+(tv1.tv_sec)*1.E6); |
54 |
|
|
*curtim = *curtim/1.E6; |
55 |
|
|
|
56 |
|
|
} |
57 |
|
|
#endif |
58 |
cnh |
1.2 |
|