summaryrefslogtreecommitdiff
path: root/include/mbgl/util
diff options
context:
space:
mode:
authorGali Nelle <galinelle.mapbox@gmail.com>2020-02-09 17:09:01 +0200
committerGali Nelle <galinelle.mapbox@gmail.com>2020-02-17 13:35:41 +0200
commit6f33547d757fb1394d1e643cdc226ae30b2edbc6 (patch)
tree02e76ddcb9e26381a9152e55287aa4d4d2d87fa5 /include/mbgl/util
parent97cab6365bd083d162544eb4bcae4ebd47a7ecae (diff)
downloadqtlocation-mapboxgl-6f33547d757fb1394d1e643cdc226ae30b2edbc6.tar.gz
Add tracing entry points in the rendering pipelineupstream/galinelle_mbgl_tracing
This also includes a default tracing implementation that does not require hooking into a platform instrumentation, but simply stores timestamps into an array that can be dumped into a json file. Among possible use cases, dumping such metrics to file in CI to detect regressions of specific stages of the pipeline.
Diffstat (limited to 'include/mbgl/util')
-rw-r--r--include/mbgl/util/chrono.hpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/mbgl/util/chrono.hpp b/include/mbgl/util/chrono.hpp
index 723cd131e3..2b16e74b32 100644
--- a/include/mbgl/util/chrono.hpp
+++ b/include/mbgl/util/chrono.hpp
@@ -9,6 +9,7 @@ using Clock = std::chrono::steady_clock;
using Seconds = std::chrono::seconds;
using Milliseconds = std::chrono::milliseconds;
+using Nanoseconds = std::chrono::nanoseconds;
using TimePoint = Clock::time_point;
using Duration = Clock::duration;
@@ -22,6 +23,10 @@ inline Timestamp now() {
return std::chrono::time_point_cast<Seconds>(std::chrono::system_clock::now());
}
+inline uint64_t now_ns() {
+ return Clock::now().time_since_epoch().count();
+}
+
// Returns the RFC1123 formatted date. E.g. "Tue, 04 Nov 2014 02:13:24 GMT"
std::string rfc1123(Timestamp);