Mercurial > hg > svgui
comparison layer/RenderTimer.h @ 1221:eaab8bab3522
Measure time taken to render per pixel, and use the time last time around to decide whether to be time constrained this time around
author | Chris Cannam |
---|---|
date | Thu, 26 Jan 2017 11:55:11 +0000 |
parents | 6f98aa5291d4 |
children | a34a2a25907c |
comparison
equal
deleted
inserted
replaced
1220:2954e9952b78 | 1221:eaab8bab3522 |
---|---|
88 } | 88 } |
89 | 89 |
90 return false; | 90 return false; |
91 } | 91 } |
92 | 92 |
93 double secondsPerItem(int itemsRendered) const { | |
94 | |
95 if (itemsRendered == 0) return 0.0; | |
96 | |
97 auto t = std::chrono::steady_clock::now(); | |
98 double elapsed = std::chrono::duration<double>(t - m_start).count(); | |
99 | |
100 return elapsed / itemsRendered; | |
101 } | |
102 | |
93 private: | 103 private: |
94 std::chrono::time_point<std::chrono::steady_clock> m_start; | 104 std::chrono::time_point<std::chrono::steady_clock> m_start; |
95 bool m_haveLimits; | 105 bool m_haveLimits; |
96 double m_minFraction; | 106 double m_minFraction; // proportion, 0.0 -> 1.0 |
97 double m_softLimit; | 107 double m_softLimit; // seconds |
98 double m_hardLimit; | 108 double m_hardLimit; // seconds |
99 bool m_softLimitOverridden; | 109 bool m_softLimitOverridden; |
100 }; | 110 }; |
101 | 111 |
102 #endif | 112 #endif |