QCDLoop
One-loop scalar Feynman integrals
timer.h
1 //
2 // QCDLoop 2016
3 //
4 // Authors: Stefano Carrazza: stefano.carrazza@cern.ch
5 // Keith Ellis: keith.ellis@durham.ac.uk
6 // Giulia Zanderighi: giulia.zanderighi@cern.ch
7 
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <sys/time.h>
11 
12 namespace ql
13 {
19  class Timer {
20 
21  public:
23  void start(){ gettimeofday(&startTime, NULL); }
24 
26  double stop()
27  {
28  timeval endTime;
29  long seconds, useconds;
30  double duration;
31  gettimeofday(&endTime, NULL);
32  seconds = endTime.tv_sec - startTime.tv_sec;
33  useconds = endTime.tv_usec - startTime.tv_usec;
34  duration = seconds + useconds/1E6f;
35  return duration;
36  }
37 
42  static void printTime(double const& duration)
43  {
44  printf("Elapsed Time: %5.6f seconds\n", duration);
45  }
46 
47  private:
48  timeval startTime;
49  };
50 
51 }
void start()
Starts the timer.
Definition: timer.h:23
double stop()
Stops the timer.
Definition: timer.h:26
Definition: box.cc:14
static void printTime(double const &duration)
Prints enlapsed time.
Definition: timer.h:42
The Timer class.
Definition: timer.h:19