30 #include <cugar/basic/types.h> 31 #include <cugar/basic/numbers.h> 60 struct CUGAR_API Timer
71 float seconds()
const;
94 float seconds()
const;
109 template <
typename T>
112 ScopedTimer(T* time) : m_time( time ), m_timer() { m_timer.start(); }
113 ~
ScopedTimer() { m_timer.stop(); *m_time += m_timer.seconds(); }
127 float seconds()
const {
return 0.0f; }
137 TimeSeries() : num(0), calls(0), time(0.0f), device_time(0.0f), max_speed(0.0f)
139 for (uint32 i = 0; i < 32; ++i)
153 void add(
const uint32 c,
const float t,
const float dt = 0.0f)
159 max_speed = std::max( max_speed,
float(c) / t );
160 if (info.size() == 10000)
162 info.push_back( std::make_pair( c, t ) );
167 bin_speed[bin] += float(c) / t;
172 float avg_speed()
const {
return float(calls) / time; }
182 uint32 bin_calls[32];
183 uint64 bin_items[32];
186 std::deque< std::pair<uint32,float> > info;
Timer()
constructor
Definition: timer.h:86
TimeSeries()
Definition: timer.h:137
CUGAR_HOST_DEVICE uint32 log2(uint32 n)
Definition: numbers.h:618
Define a vector_view POD type and plain_view() for std::vector.
Definition: diff.h:38
void add(const uint32 c, const float t, const float dt=0.0f)
Definition: timer.h:153