#ifndef __TIMER__
#define __TIMER__

#include <string>
#include <vector>

/** Simple class designed to keep track of time measurements.
 *
 * This timer class uses the OpenMP wall time to track timesteps. Labels are
 * assigned to each timestep and the initial time is defined on construction.
 *
 * The timing for each label is reported in seconds since the previous label. In
 * addition, the total wallclock time is reported in hours minutes and seconds-
 *
 * If running under MPI, a toggle controls if all processes are synchronized for
 * the timing.
 */
class Timer {

  private:
    std::vector<double>      times;  // Time stamp values
    std::vector<std::string> labels; // Time stamp labels

  public:
    /** Construct a new timer object. */
    Timer();
    /** Destroy the timer object. */
    ~Timer();

    /** Addition of a new timestamp with a given label
     *
     * @param label reported
     * @param mpi_sync If running under MPI we can sync processes if needed.
     */
    void add(std::string label, bool mpi_sync = true);

    /** Print the contents of the timer with given precision. (default 0.00) */
    void print(int precision = 2);
};

#endif /* __TIMER__ */