17 #ifndef ARUCO_TIMERS_H 18 #define ARUCO_TIMERS_H 32 std::chrono::high_resolution_clock::time_point
begin,
end;
49 begin = std::chrono::high_resolution_clock::now();
62 end = std::chrono::high_resolution_clock::now();
81 std::cout <<
"Time(" << name <<
")= " 83 std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin).count()) /
101 std::vector<std::chrono::high_resolution_clock::time_point>
vtimes;
122 vtimes.push_back(std::chrono::high_resolution_clock::now());
123 names.push_back(name);
133 m = std::max(
size_t(s.size()), m);
164 for (
size_t i = 1; i < vtimes.size(); i++)
166 std::cout <<
"Time(" << _name <<
"|" << names[i] <<
" ):" 167 << double(std::chrono::duration_cast<std::chrono::nanoseconds>(
168 vtimes[i] - vtimes[i - 1])
172 << double(std::chrono::duration_cast<std::chrono::nanoseconds>(vtimes[i] -
191 std::chrono::high_resolution_clock::time_point
_s;
192 double sum = 0, n = 0;
207 _s = std::chrono::high_resolution_clock::now();
211 auto e = std::chrono::high_resolution_clock::now();
212 sum += double(std::chrono::duration_cast<std::chrono::nanoseconds>(e - _s).count());
236 std::cout <<
"Time(" << _name <<
")= " << (sum / n) / fact << str << std::endl;
258 return (sum / n) / fact;
264 res.reserve(prettyFunction.size());
265 bool spaceFound =
false;
266 for (
auto c : prettyFunction)
268 if (c ==
' ' && !spaceFound)
270 else if (c !=
'(' && spaceFound)
272 else if (c ==
'(' && spaceFound)
279 #define __ARUCO_ADDTIMER__ \ 280 ScopedTimerEvents XTIMER_X(__pf_aruco_methodName(__PRETTY_FUNCTION__)); 281 #define __ARUCO_TIMER_EVENT__(Y) XTIMER_X.add(Y); 283 #define __ARUCO_ADDTIMER__ 284 #define __ARUCO_TIMER_EVENT__(Y)
std::vector< std::string > names
std::chrono::high_resolution_clock::time_point _s
std::vector< std::chrono::high_resolution_clock::time_point > vtimes
std::string __pf_aruco_methodName(std::string prettyFunction)
void print(SCALE sc=MSEC)
ScopedTimerEvents(std::string name="", bool start=true, SCALE _sc=MSEC)
std::chrono::high_resolution_clock::time_point end
void addspaces(std::vector< std::string > &str)
double getAverage(SCALE sc=MSEC) const
ScopeTimer(std::string name_, bool use_=true, SCALE _sc=MSEC)
void add(std::string name)
std::chrono::high_resolution_clock::time_point begin
void setName(std::string name)