OpenPFC  0.1.4
Phase Field Crystal simulation framework
Loading...
Searching...
No Matches
timer.hpp File Reference

MPI-based wall-clock timer. More...

#include <iostream>
#include <mpi.h>
#include <string>
Include dependency graph for timer.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  pfc::mpi::timer
 

Functions

std::ostream & pfc::mpi::operator<< (std::ostream &os, const timer &t)
 

Detailed Description

MPI-based wall-clock timer.

This header provides the timer class for measuring wall-clock time using MPI_Wtime(), which provides consistent timing across MPI ranks.

The timer class provides:

  • tic(): Start timing
  • toc(): Stop timing and return elapsed time
  • duration(): Get total accumulated duration
  • reset(): Reset accumulated duration
  • description(): Set/get timer description for logging
t.description("FFT computation");
t.tic();
// ... perform FFT ...
double elapsed = t.toc();
std::cout << t << std::endl; // Print timer with description
Definition timer.hpp:47
MPI-based wall-clock timer.
See also
mpi/environment.hpp for MPI initialization
mpi.hpp for top-level MPI utilities
Author
OpenPFC Development Team
Date
2025