#ifndef __TIMER__
#define __TIMER__

#include <sys/time.h>
#include <sys/resource.h>
#include <iostream>

/// simple timer class
/**
 * returns time used by user in seconds
 */
class timer
{
 public:
  timer();
  ~timer();
  void reset();
  void start();
  void stop();
  double getseconds();
  double getcpu();
 private:
  timeval rstart;
  timeval rstop;
  rusage ustart;
  rusage ustop;

  double cpuusec;
  double timeusec;
};

#endif
