Commit da948c82 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #5106 from vladimir-dudnik:opencl-opengl-upd

parents 0f8c46f3 5c4c8bce
This diff is collapsed.
......@@ -22,6 +22,54 @@
#define SAFE_RELEASE(p) if (p) { p->Release(); p = NULL; }
class Timer
{
public:
enum UNITS
{
USEC = 0,
MSEC,
SEC
};
Timer() : m_t0(0), m_diff(0)
{
m_tick_frequency = (float)cv::getTickFrequency();
m_unit_mul[USEC] = 1000000;
m_unit_mul[MSEC] = 1000;
m_unit_mul[SEC] = 1;
}
void clear()
{
m_t0 = m_diff = 0;
}
void start()
{
m_t0 = cv::getTickCount();
}
void stop()
{
m_diff = cv::getTickCount() - m_t0;
}
float time(UNITS u = UNITS::MSEC)
{
float sec = m_diff / m_tick_frequency;
return sec * m_unit_mul[u];
}
public:
float m_tick_frequency;
int64 m_t0;
int64 m_diff;
int m_unit_mul[3];
};
class WinApp
{
public:
......@@ -162,9 +210,9 @@ public:
idle();
}
} while (!m_end_loop);
#endif
return 0;
#endif
}
protected:
......@@ -218,4 +266,5 @@ protected:
int m_width;
int m_height;
std::string m_window_name;
Timer m_timer;
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment