This source file includes following definitions.
- MPI_Wtick
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include "ompi_config.h"
25
26 #ifdef HAVE_SYS_TIME_H
27 #include <sys/time.h>
28 #endif
29 #include <stdio.h>
30 #ifdef HAVE_TIME_H
31 #include <time.h>
32 #endif
33
34 #include MCA_timer_IMPLEMENTATION_HEADER
35 #include "ompi/mpi/c/bindings.h"
36 #include "ompi/runtime/mpiruntime.h"
37
38 #if OMPI_BUILD_MPI_PROFILING
39 #if OPAL_HAVE_WEAK_SYMBOLS
40 #pragma weak MPI_Wtick = PMPI_Wtick
41 #endif
42 #define MPI_Wtick PMPI_Wtick
43 #endif
44
45 double MPI_Wtick(void)
46 {
47 OPAL_CR_NOOP_PROGRESS();
48
49
50
51
52
53 #if 0
54 #if OPAL_TIMER_CYCLE_NATIVE
55 {
56 opal_timer_t freq = opal_timer_base_get_freq();
57 if (0 == freq) {
58
59
60 return (double)0.0;
61 }
62 return (double)1.0 / (double)freq;
63 }
64 #elif OPAL_TIMER_USEC_NATIVE
65 return 0.000001;
66 #endif
67 #else
68 #if defined(__linux__) && OPAL_HAVE_CLOCK_GETTIME
69 struct timespec spec;
70 double wtick = 0.0;
71 if (0 == clock_getres(CLOCK_MONOTONIC, &spec)){
72 wtick = spec.tv_sec + spec.tv_nsec * 1.0e-09;
73 } else {
74
75 wtick = 1.0e-09;
76 }
77 return wtick;
78 #else
79
80 return 0.000001;
81 #endif
82 #endif
83 }