Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Energy, onHostDestruction: ensured ptr existence
[simgrid.git] / examples / smpi / NAS / common / c_timers.c
1
2 #include "mpi.h"
3
4 double start[64], elapsed[64];
5
6 /*****************************************************************/
7 /******            T  I  M  E  R  _  C  L  E  A  R          ******/
8 /*****************************************************************/
9 void timer_clear( int n )
10 {
11     elapsed[n] = 0.0;
12 }
13
14
15 /*****************************************************************/
16 /******            T  I  M  E  R  _  S  T  A  R  T          ******/
17 /*****************************************************************/
18 void timer_start( int n )
19 {
20     start[n] = MPI_Wtime();
21 }
22
23
24 /*****************************************************************/
25 /******            T  I  M  E  R  _  S  T  O  P             ******/
26 /*****************************************************************/
27 void timer_stop( int n )
28 {
29     double t, now;
30
31     now = MPI_Wtime();
32     t = now - start[n];
33     elapsed[n] += t;
34
35 }
36
37
38 /*****************************************************************/
39 /******            T  I  M  E  R  _  R  E  A  D             ******/
40 /*****************************************************************/
41 double timer_read( int n )
42 {
43     return( elapsed[n] );
44 }
45