diff options
author | louiz’ <louiz@louiz.org> | 2018-01-14 21:46:49 +0100 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2018-01-14 21:46:49 +0100 |
commit | 7e64a2e361adcdbd2fce5ad76051a150b4de062d (patch) | |
tree | b90208a43341ba626fffb42a6a6d63dd126ba561 /src/utils | |
parent | 3cd649023680bd49f9865fd62474d4db6a9d7c68 (diff) | |
download | biboumi-7e64a2e361adcdbd2fce5ad76051a150b4de062d.tar.gz biboumi-7e64a2e361adcdbd2fce5ad76051a150b4de062d.tar.bz2 biboumi-7e64a2e361adcdbd2fce5ad76051a150b4de062d.tar.xz biboumi-7e64a2e361adcdbd2fce5ad76051a150b4de062d.zip |
Add a DEBUG_SQL_QUERIES to log info about the executed SQL queries
fix #3324
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/scopetimer.hpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/utils/scopetimer.hpp b/src/utils/scopetimer.hpp new file mode 100644 index 0000000..7d3db9b --- /dev/null +++ b/src/utils/scopetimer.hpp @@ -0,0 +1,17 @@ +#include <utils/scopeguard.hpp> + +#include <chrono> + +#include <logger/logger.hpp> + +template <typename Callback> +auto make_scope_timer(Callback cb) +{ + const auto start_time = std::chrono::steady_clock::now(); + return utils::make_scope_guard([start_time, cb = std::move(cb)]() + { + const auto now = std::chrono::steady_clock::now(); + const auto elapsed = now - start_time; + cb(elapsed); + }); +} |