15 template <
class clock>
36#ifndef ENGINE_NO_SOURCE_LOCATION
38 std::source_location location = std::source_location::current())
62 const float t =
measure.elapsed();
80 const float average =
avg();
81 const float avg_over_the_flush =
avg(entries_amount);
83 std::stringstream out;
84 out <<
output << std::endl;
85 out <<
"Amount of calls over the last " << std::setprecision(3) <<
flush.elapsed() <<
" seconds: ";
86 out << entries_amount << std::endl;
87 out <<
"Average % of time the function took over the last ";
88 out << std::setprecision(3) <<
flush.elapsed() <<
" seconds: ";
89 out << std::setprecision(7) << avg_over_the_flush * entries_amount /
flush.elapsed() * 100;
91 out <<
"Average time the function took over " <<
entries.size() <<
" calls: ";
92 out << std::setprecision(7) << average * 1000 <<
" milliseconds" << std::endl;
93 out <<
"Average time the function took over the last " << entries_amount <<
" calls: ";
94 out << std::setprecision(7) << avg_over_the_flush * 1000 <<
" milliseconds" << std::endl;
96 spdlog::info(out.str());
104 float avg(
const size_t last_n_entries = std::numeric_limits<size_t>::max())
108 for (int64_t i =
static_cast<int64_t
>(
entries.size()) - 1; counter < last_n_entries && i >= 0;
124 int64_t i =
static_cast<int64_t
>(
entries.size()) - 1;
144 int64_t i =
static_cast<int64_t
>(
entries.size()) - 1;
153 if (i < 0 &&
entries.size() > 0)
155 return rv /
entries.back().entry_time;
168 int64_t i = int64_t(
entries.size()) - 1;
Contains debugging-related macros and utilities for assisting with debugging tasks.
Implements timer utilities for measuring elapsed time and intervals.