MPI defines a timer which is very convenient for performance debugging and which provides a portable timing facility.
MPI_WTIME() Code double MPI_Wtime(void)
MPI_WTIME returns a floating-point number of seconds,
representing wall-clock time. To time a process, you can call
MPI_WTIME just before the process starts, and again just after
the process ends; then calculate the difference between the two times.