Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add mpich3 test suite, to replace older one.
[simgrid.git] / teshsuite / smpi / mpich-test / env / timertest.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "mpi.h"
4 #include "test.h"
5 #ifdef HAVE_WINDOWS_H
6 #define sleep(a_) Sleep((a_)*1000)
7 #include <windows.h>
8 #endif
9
10 int main( int argc, char **argv )
11 {
12     double t1, t2;
13     double tick;
14     int    i;
15
16     MPI_Init( &argc, &argv );
17     t1 = MPI_Wtime();
18     t2 = MPI_Wtime();
19     fprintf( stdout, "Two successive calls to MPI_Wtime gave: (%f) (%f)\n", 
20                 t1, t2 );
21     fprintf( stdout, "Five approximations to one second:\n");
22     for (i = 0; i < 5; i++)
23     {
24         t1 = MPI_Wtime();
25         sleep(1);
26         t2 = MPI_Wtime();
27         fprintf( stdout, "%f seconds\n", t2 - t1 );
28     } 
29     tick = MPI_Wtick();
30     fprintf( stdout, "MPI_Wtick gave: (%10.8f)\n", tick );
31
32     MPI_Finalize( );
33
34     return 0;
35 }