47#define __FUNC__ "Timer_dhCreate"
49Timer_dhCreate (Timer_dh * t)
57 tmp->isRunning =
false;
58 tmp->begin_wall = 0.0;
61 tmp->sc_clk_tck = CLOCKS_PER_SEC;
63 tmp->sc_clk_tck = sysconf (128);
66#if defined(EUCLID_TIMING)
67 sprintf (msgBuf_dh,
"using EUCLID_TIMING; _SC_CLK_TCK = %i",
68 (
int) tmp->sc_clk_tck);
70#elif defined(MPI_TIMING)
71 SET_INFO (
"using MPI timing")
73 SET_INFO (
"using JUNK timing")
78#define __FUNC__ "Timer_dhDestroy"
80Timer_dhDestroy (Timer_dh t)
82 START_FUNC_DH FREE_DH (t);
93#define __FUNC__ "Timer_dhStart"
95Timer_dhStart (Timer_dh t)
97 START_FUNC_DH t->begin_wall = times (&(t->begin_cpu));
102#define __FUNC__ "Timer_dhStop"
104Timer_dhStop (Timer_dh t)
106 START_FUNC_DH t->end_wall = times (&(t->end_cpu));
107 t->isRunning =
false;
111#define __FUNC__ "Timer_dhReadWall"
113Timer_dhReadWall (Timer_dh t)
115 START_FUNC_DH
double retval = 0.0;
116 long int sc_clk_tck = t->sc_clk_tck;
118 t->end_wall = times (&(t->end_cpu));
119 retval = (double) (t->end_wall - t->begin_wall) / (double) sc_clk_tck;
120END_FUNC_VAL (retval)}
123#define __FUNC__ "Timer_dhReadCPU"
125Timer_dhReadCPU (Timer_dh t)
127 START_FUNC_DH
double retval;
128 long int sc_clk_tck = t->sc_clk_tck;
130 t->end_wall = times (&(t->end_cpu));
131 retval = (double) (t->end_cpu.tms_utime - t->begin_cpu.tms_utime
132 + t->end_cpu.tms_stime - t->begin_cpu.tms_stime
133 + t->end_cpu.tms_cutime - t->begin_cpu.tms_cutime
134 + t->end_cpu.tms_cstime - t->begin_cpu.tms_cstime)
135 / (double) sc_clk_tck;
136END_FUNC_VAL (retval)}
139#define __FUNC__ "Timer_dhReadUsage"
141Timer_dhReadUsage (Timer_dh t)
143 START_FUNC_DH
double cpu = Timer_dhReadCPU (t);
144 double wall = Timer_dhReadWall (t);
145 double retval = 100.0 * cpu / wall;
146 END_FUNC_VAL (retval);
154#elif defined(MPI_TIMING)
157#define __FUNC__ "Timer_dhStart"
159Timer_dhStart (Timer_dh t)
161 START_FUNC_DH t->begin_wall = MPI_Wtime ();
166#define __FUNC__ "Timer_dhStop"
168Timer_dhStop (Timer_dh t)
170 START_FUNC_DH t->end_wall = MPI_Wtime ();
171 t->isRunning =
false;
175#define __FUNC__ "Timer_dhReadWall"
177Timer_dhReadWall (Timer_dh t)
179 START_FUNC_DH
double retval;
181 t->end_wall = MPI_Wtime ();
182 retval = t->end_wall - t->begin_wall;
183END_FUNC_VAL (retval)}
186#define __FUNC__ "Timer_dhReadCPU"
188Timer_dhReadCPU (Timer_dh t)
190START_FUNC_DH END_FUNC_VAL (-1.0)}
193#define __FUNC__ "Timer_dhReadUsage"
195Timer_dhReadUsage (Timer_dh t)
197 START_FUNC_DH END_FUNC_VAL (-1.0);
208#define __FUNC__ "Timer_dhStart"
210Timer_dhStart (Timer_dh t)
212START_FUNC_DH END_FUNC_DH}
215#define __FUNC__ "Timer_dhStop"
217Timer_dhStop (Timer_dh t)
219START_FUNC_DH END_FUNC_DH}
222#define __FUNC__ "Timer_dhReadWall"
224Timer_dhReadWall (Timer_dh t)
226START_FUNC_DH END_FUNC_VAL (-1.0)}
229#define __FUNC__ "Timer_dhReadCPU"
231Timer_dhReadCPU (Timer_dh t)
233START_FUNC_DH END_FUNC_VAL (-1.0)}
236#define __FUNC__ "Timer_dhReadUsage"
238Timer_dhReadUsage (Timer_dh t)
240 START_FUNC_DH END_FUNC_VAL (-1.0);