summaryrefslogtreecommitdiff
path: root/benchmark/src
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2016-10-04 18:39:54 +0300
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2016-10-05 11:12:16 +0300
commita38104ee2294117032891faca13ca7da834beaa3 (patch)
tree93871ecd554a893a72c735545e0b7158b5e022b9 /benchmark/src
parent82b801250ef69cc9dc5f73f64c41ce6d37b86270 (diff)
downloadqtlocation-mapboxgl-a38104ee2294117032891faca13ca7da834beaa3.tar.gz
[tests] Added benchmarks for querying for features
Diffstat (limited to 'benchmark/src')
-rw-r--r--benchmark/src/mbgl/benchmark/util.cpp22
-rw-r--r--benchmark/src/mbgl/benchmark/util.hpp12
2 files changed, 34 insertions, 0 deletions
diff --git a/benchmark/src/mbgl/benchmark/util.cpp b/benchmark/src/mbgl/benchmark/util.cpp
new file mode 100644
index 0000000000..a8f71f1206
--- /dev/null
+++ b/benchmark/src/mbgl/benchmark/util.cpp
@@ -0,0 +1,22 @@
+#include <mbgl/benchmark/util.hpp>
+
+#include <mbgl/map/map.hpp>
+#include <mbgl/util/image.hpp>
+#include <mbgl/util/run_loop.hpp>
+
+namespace mbgl {
+namespace benchmark {
+
+void render(Map& map) {
+ PremultipliedImage result;
+ map.renderStill([&result](std::exception_ptr, PremultipliedImage&& image) {
+ result = std::move(image);
+ });
+
+ while (!result.size()) {
+ util::RunLoop::Get()->runOnce();
+ }
+}
+
+} // namespace benchmark
+} // namespace mbgl
diff --git a/benchmark/src/mbgl/benchmark/util.hpp b/benchmark/src/mbgl/benchmark/util.hpp
new file mode 100644
index 0000000000..759015e0e3
--- /dev/null
+++ b/benchmark/src/mbgl/benchmark/util.hpp
@@ -0,0 +1,12 @@
+#pragma once
+
+namespace mbgl {
+
+class Map;
+
+namespace benchmark {
+
+void render(Map&);
+
+} // namespace benchmark
+} // namespace mbgl