37 #ifndef _PCL_CUDA_TIMERS_HPP_
38 #define _PCL_CUDA_TIMERS_HPP_
40 #include <cuda_runtime_api.h>
52 cudaEventCreate(&start_);
53 cudaEventCreate(&stop_);
59 cudaEventDestroy(start_);
60 cudaEventDestroy(stop_);
63 void start()
const { cudaEventRecord(start_, 0); }
64 Timer&
stop() { cudaEventRecord(stop_, 0); cudaEventSynchronize(stop_);
return *
this; }
69 cudaEventElapsedTime(&elapsed_time, start_, stop_);
80 cudaEventCreate(&start);
81 cudaEventCreate(&stop);
82 cudaEventRecord(start);
87 cudaEventRecord(stop);
88 cudaEventSynchronize(stop);
89 cudaEventElapsedTime(&elapsed_time, start, stop);
90 printf(
"Time(%s) = %fms\n", name, elapsed_time);
91 cudaEventDestroy(start);
92 cudaEventDestroy(stop);
Timer(bool runTimer=false)
ScopeTimer(const char *name_)