diff options
author | Alex Zolotarev <deathbaba@gmail.com> | 2011-08-28 00:04:30 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:22:39 +0300 |
commit | eb15ccc1e3506d3b3056790fcae4fb322d38ac82 (patch) | |
tree | 2c1350699aa70360259479bf32f01c59614a7d6e /map/benchmark_tool | |
parent | e175caa98a5a30f54421b59aaa125352a29a1c8e (diff) |
[benchmark_tool] Rewrote and fixed benchmark rects logic
Now it correctly works with countries and World
Diffstat (limited to 'map/benchmark_tool')
-rw-r--r-- | map/benchmark_tool/features_loading.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/map/benchmark_tool/features_loading.cpp b/map/benchmark_tool/features_loading.cpp index aeda097f96..d8914d12f9 100644 --- a/map/benchmark_tool/features_loading.cpp +++ b/map/benchmark_tool/features_loading.cpp @@ -35,7 +35,7 @@ namespace m_count = 0; } - bool IsEmpty() const { return m_count > 0; } + bool IsEmpty() const { return m_count == 0; } double GetReadingTime() const { return m_reading; } @@ -52,32 +52,33 @@ namespace } }; - double RunBenchmark(model::FeaturesFetcher const & src, m2::RectD const & rect) + double RunBenchmark(model::FeaturesFetcher const & src, m2::RectD const & rect, + pair<int, int> const & scaleRange) { - vector<m2::RectD> rects; + vector<m2::RectD> rects, newRects; rects.push_back(rect); + Accumulator acc; - while (!rects.empty()) + for (int scale = scaleRange.first; scale < scaleRange.second; ++scale) { - m2::RectD r = rects.back(); - rects.pop_back(); + for (size_t i = 0; i < rects.size(); ++i) + { + m2::RectD const r = rects[i]; - int const scale = scales::GetScaleLevel(r); - acc.Reset(scale); + acc.Reset(scale); - src.ForEachFeature_TileDrawing(r, acc, scale); + src.ForEachFeature_TileDrawing(r, acc, scale); - if (!acc.IsEmpty() && (scale < scales::GetUpperScale())) - { m2::RectD r1, r2; r.DivideByGreaterSize(r1, r2); - rects.push_back(r1); - rects.push_back(r2); + newRects.push_back(r1); + newRects.push_back(r2); } + rects.swap(newRects); + newRects.clear(); } - return acc.GetReadingTime(); } } @@ -89,17 +90,17 @@ void RunFeaturesLoadingBenchmark(string const & file, size_t count) src.AddMap(file); m2::RectD const rect = GetMapBounds(FilesContainerR(GetPlatform().GetReader(file))); + pair<int, int> const scaleRange = GetMapScaleRange(FilesContainerR(GetPlatform().GetReader(file))); my::Timer timer; double all = 0.0; double reading = 0.0; - size_t const count = 2; for (size_t i = 0; i < count; ++i) { timer.Reset(); - reading += RunBenchmark(src, rect); + reading += RunBenchmark(src, rect, scaleRange); all += timer.ElapsedSeconds(); } |