GeNN  3.3.0
GPU enhanced Neuronal Networks (GeNN)
hr_time.h
Go to the documentation of this file.
1 //--------------------------------------------------------------------------
6 //--------------------------------------------------------------------------
7 
8 #ifndef __HR_TIME_H
9 #define __HR_TIME_H
10 
11 #ifdef _WIN32
12 #include <windows.h>
13 
14 typedef struct {
15  LARGE_INTEGER start;
16  LARGE_INTEGER stop;
17 } stopWatch;
18 
19 class CStopWatch {
20 private:
21  stopWatch timer;
22  LARGE_INTEGER frequency;
23  double LIToSecs( LARGE_INTEGER & L);
24 public:
25  CStopWatch();
26  void startTimer( );
27  void stopTimer( );
28  double getElapsedTime();
29 };
30 
31 #else
32 #include <sys/time.h>
33 
34 typedef struct {
35  timeval start;
36  timeval stop;
37 } stopWatch;
38 
40 
41 class CStopWatch {
42 private:
43  stopWatch timer;
44 public:
45  CStopWatch() {};
46  void startTimer( );
47  void stopTimer( );
48  double getElapsedTime();
49 };
50 
51 #endif
52 
53 #endif
Helper class for timing sections of host code in a cross-plarform manner.
Definition: hr_time.h:41
Definition: hr_time.h:34
double getElapsedTime()
This method returns the time elapsed between start and stop of the timer in seconds.
Definition: hr_time.cc:67
timeval stop
Definition: hr_time.h:36
void stopTimer()
This method stops the timer.
Definition: hr_time.cc:58
CStopWatch()
Definition: hr_time.h:45
void startTimer()
This method starts the timer.
Definition: hr_time.cc:49
timeval start
Definition: hr_time.h:35