diff options
author | Lloyd Sheng <i@lloydsheng.com> | 2018-06-19 17:17:12 +0800 |
---|---|---|
committer | Lloyd Sheng <i@lloydsheng.com> | 2018-06-19 17:17:12 +0800 |
commit | d0fd03225f5df28b349320e4c7f328baa43522c5 (patch) | |
tree | f3f4a81178ea1f622b3e6d3a376437a896b1dec1 /src/mbgl/util/stopwatch.hpp | |
parent | bc02a43c67c5365feac95ff551cd1a250754d707 (diff) | |
download | qtlocation-mapboxgl-d0fd03225f5df28b349320e4c7f328baa43522c5.tar.gz |
Refactor logging code
Diffstat (limited to 'src/mbgl/util/stopwatch.hpp')
-rw-r--r-- | src/mbgl/util/stopwatch.hpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mbgl/util/stopwatch.hpp b/src/mbgl/util/stopwatch.hpp index 6214dae958..0782aa742f 100644 --- a/src/mbgl/util/stopwatch.hpp +++ b/src/mbgl/util/stopwatch.hpp @@ -4,9 +4,21 @@ #include <mbgl/util/chrono.hpp> #include <string> +#include <sstream> namespace mbgl { namespace util { + +#ifdef MBGL_TIMING +#define MBGL_TIMING_START(watch) std::shared_ptr<util::stopwatch> watch = std::make_unique<util::stopwatch>(Event::Timing); +#define MBGL_TIMING_FINISH(watch, message) \ + std::stringstream messageStream; \ + messageStream << message; \ + watch->report(messageStream.str()); +#else +#define MBGL_TIMING_START(watch) +#define MBGL_TIMING_FINISH(watch, message) +#endif #ifndef DISABLE_STOPWATCH class stopwatch { |