From 8682e4c44b5b4c8ac3407dbfccd87db646c369ae Mon Sep 17 00:00:00 2001 From: rachytski Date: Sat, 13 Aug 2011 23:27:39 +0300 Subject: [PATCH] Fixed benchmarking code. Read "Benchmarking" page on github wiki. --- map/benchmark_framework.cpp | 21 ++++++++++++++++----- map/benchmark_framework.hpp | 1 + 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/map/benchmark_framework.cpp b/map/benchmark_framework.cpp index 401cbcd69e..a2902c9269 100644 --- a/map/benchmark_framework.cpp +++ b/map/benchmark_framework.cpp @@ -12,7 +12,8 @@ #include "../version/version.hpp" -#include "tiling_render_policy_st.hpp" +//#include "tiling_render_policy_st.hpp" +#include "render_policy_st.hpp" template class DoGetBenchmarks { @@ -28,6 +29,9 @@ public: void operator() (vector const & v) { + if (v[0][0] == '#') + return; + T b; b.m_name = v[1]; @@ -113,6 +117,9 @@ public: FirstReaderAdder(maps_list_t & lst) : base_type(GetPlatform(), lst) {} void operator() (vector const & v) { + if (!v[0].empty()) + if (v[0][0] == '#') + return; base_type::operator() (v[0]); } }; @@ -130,9 +137,10 @@ BenchmarkFramework::BenchmarkFramework(shared_ptr const & : base_type(wh, bottomShift), m_paintDuration(0), m_maxDuration(0), - m_isBenchmarkInitialized(false) + m_isBenchmarkInitialized(false), + m_isBenchmarkFinished(false) { - base_type::SetRenderPolicy(make_shared_ptr(new TilingRenderPolicyST(wh, bind(&base_type::DrawModel, this, _1, _2, _3, _4)))); + base_type::SetRenderPolicy(make_shared_ptr(new RenderPolicyST(wh, bind(&base_type::DrawModel, this, _1, _2, _3, _4)))); m_startTime = my::FormatCurrentTime(); @@ -166,7 +174,8 @@ void BenchmarkFramework::BenchmarkCommandFinished() m_paintDuration = 0; - NextBenchmarkCommand(); + if (!m_isBenchmarkFinished) + NextBenchmarkCommand(); } template @@ -237,6 +246,7 @@ void BenchmarkFramework::NextBenchmarkCommand() static bool isFirstTime = true; if (isFirstTime) { + m_isBenchmarkFinished = true; isFirstTime = false; SaveBenchmarkResults(); MarkBenchmarkResultsEnd(); @@ -295,7 +305,8 @@ void BenchmarkFramework::Paint(shared_ptr e) double s = m_benchmarksTimer.ElapsedSeconds(); Framework::Paint(e); m_paintDuration += m_benchmarksTimer.ElapsedSeconds() - s; - BenchmarkCommandFinished(); + if (!m_isBenchmarkFinished) + BenchmarkCommandFinished(); } template class BenchmarkFramework; diff --git a/map/benchmark_framework.hpp b/map/benchmark_framework.hpp index 194e6e77e6..643ea4d748 100644 --- a/map/benchmark_framework.hpp +++ b/map/benchmark_framework.hpp @@ -49,6 +49,7 @@ private: vector m_benchmarks; size_t m_curBenchmark; + bool m_isBenchmarkFinished; bool m_isBenchmarkInitialized; void BenchmarkCommandFinished();