#ifndef TIMER_H
#define TIMER_H
// timer.h
// 
// Process timer


#include <ctime>
#include <string>

#ifndef WIN32
#include <sys/times.h>
#include <unistd.h>
#endif

class Timer
{
  public:
    // ------------------------------------------------------------------------
    Timer();

    // ------------------------------------------------------------------------
    Timer(const std::string &label);

    // ------------------------------------------------------------------------
    ~Timer();

    // ------------------------------------------------------------------------
    void start(void);

    // ------------------------------------------------------------------------
    void stop(void);

    // ------------------------------------------------------------------------
    void show(void);
 
    // ------------------------------------------------------------------------
    double get_user_time(void);
    double get_system_time(void);
    double get_wait_time(void);
    double get_elapsed_time(void);
    double get_non_wait_time(void);

  private:

    // ------------------------------------------------------------------------
    void reset(void);

    std::string
      label;

    long 
      tps;

    #ifdef WIN32
      clock_t 
        start_time,
        end_time;
    #else
      long 
        start_time,
        end_time;
    #endif

    double 
      usertime,
      systemtime,
      elapsedtime,
      waittime;

    #ifndef WIN32
      struct tms 
        start_cpu_time,
        end_cpu_time;
    #endif
};
#endif
// eof timer.h
