Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrachytski <siarhei.rachytski@gmail.com>2012-07-13 01:19:46 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:40:58 +0300
commit24bf99738240f4ab08b88672f8c9dc191aa5e340 (patch)
treea46fc4b20ae45fec93f8cda50536beb15c89704a /map/benchmark_engine.hpp
parent132f07f8bef9ee51582c71f4d3fb079b5ebaddb2 (diff)
added consistent benchmarking for all RenderPolicies.
Diffstat (limited to 'map/benchmark_engine.hpp')
-rw-r--r--map/benchmark_engine.hpp74
1 files changed, 74 insertions, 0 deletions
diff --git a/map/benchmark_engine.hpp b/map/benchmark_engine.hpp
new file mode 100644
index 0000000000..28d8a22378
--- /dev/null
+++ b/map/benchmark_engine.hpp
@@ -0,0 +1,74 @@
+#pragma once
+
+#include "framework.hpp"
+
+#include "../geometry/rect2d.hpp"
+
+#include "../base/timer.hpp"
+#include "../base/thread.hpp"
+
+#include "../std/string.hpp"
+#include "../std/vector.hpp"
+#include "../std/shared_ptr.hpp"
+
+struct BenchmarkRectProvider;
+class WindowHandle;
+class PaintEvent;
+
+/// BenchmarkEngine is class which:
+/// - Creates it's own thread
+/// - Feeds the Framework with the paint tasks he wants to performs
+/// - Wait until each tasks completion
+/// - Measure the time of each task and save the result
+class BenchmarkEngine : public threads::IRoutine
+{
+private:
+
+ threads::Thread m_thread;
+
+ double m_paintDuration;
+ double m_maxDuration;
+ m2::RectD m_maxDurationRect;
+ m2::RectD m_curBenchmarkRect;
+
+ string m_startTime;
+
+ struct BenchmarkResult
+ {
+ string m_name;
+ m2::RectD m_rect;
+ double m_time;
+ };
+
+ vector<BenchmarkResult> m_benchmarkResults;
+ my::Timer m_benchmarksTimer;
+
+ struct Benchmark
+ {
+ shared_ptr<BenchmarkRectProvider> m_provider;
+ string m_name;
+ };
+
+ vector<Benchmark> m_benchmarks;
+ size_t m_curBenchmark;
+
+ Framework * m_framework;
+
+ void BenchmarkCommandFinished();
+ bool NextBenchmarkCommand();
+ void SaveBenchmarkResults();
+ void SendBenchmarkResults();
+
+ void MarkBenchmarkResultsStart();
+ void MarkBenchmarkResultsEnd();
+
+ void PrepareMaps();
+
+ void Do();
+
+public:
+
+ BenchmarkEngine(Framework * fw);
+
+ void Start();
+};