31 #include <cugar/basic/types.h> 32 #include <cuda_runtime.h> 68 cudaEvent_t m_start, m_stop;
78 ScopedTimer(T* time) : m_time( time ), m_timer() { m_timer.start(); }
79 ~
ScopedTimer() { m_timer.stop(); *m_time += m_timer.seconds(); }
89 cudaEventCreate(&m_start);
90 cudaEventCreate(&m_stop);
97 cudaEventDestroy(m_start);
98 cudaEventDestroy(m_stop);
105 cudaEventRecord(m_start, 0);
112 cudaEventRecord(m_stop, 0);
121 cudaEventSynchronize(m_stop);
122 cudaEventElapsedTime(&elapsedTime, m_start, m_stop);
123 return elapsedTime * 1.0e-3f;
~Timer()
Definition: timer.h:95
void start()
Definition: timer.h:103
Timer()
Definition: timer.h:87
Define a vector_view POD type and plain_view() for std::vector.
Definition: diff.h:38
float seconds() const
Definition: timer.h:118
void stop()
Definition: timer.h:110