#include <iostream.h>
#include <mpi/mpi.h>

main(int argc, char* argv[])
{
// Setup phase, same on all processors

  MPI_Init(&argc, &argv); // start MPI
  const int N = 30;
  double A[N];

// Compute phase.
for (int j = 0; j < N; ++j)
{
  double start = MPI_Wtime();
  int i = 0;
  while (MPI_Wtime() == start) ++i;
  A[j] = i;
}

  for( int j = 0; j < N; ++j)
    cout << j << ": " << A[j] << " iterations to the tick\n";

// Final phase 

  cout << "MPI_Wtick() = " << MPI_Wtick() << " and ticks per sec = " << 1/MPI_Wtick() << endl; 
  MPI_Finalize();  
}

