diff options
author | vng <viktor.govako@gmail.com> | 2013-02-21 23:17:52 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:51:22 +0300 |
commit | f4a9517f296862ee33899a8a5d3542d50b8075fc (patch) | |
tree | ec8ab2f12a86da9749e64b5c8030c97557819cbe /map/benchmark_engine.cpp | |
parent | 04c48bb054e3062dda273a4bd3f35911dce5c449 (diff) |
- Remove version.pro generating;
- New HEADER format for mwm container with mwm data version;
- Increase mom version because of new search index format;
Diffstat (limited to 'map/benchmark_engine.cpp')
-rw-r--r-- | map/benchmark_engine.cpp | 60 |
1 files changed, 28 insertions, 32 deletions
diff --git a/map/benchmark_engine.cpp b/map/benchmark_engine.cpp index 55afff7cb9..64c51477d5 100644 --- a/map/benchmark_engine.cpp +++ b/map/benchmark_engine.cpp @@ -5,11 +5,10 @@ #include "../platform/platform.hpp" #include "../coding/file_container.hpp" +#include "../coding/reader_streambuf.hpp" #include "../std/fstream.hpp" -#include "../version/version.hpp" - template <class T> class DoGetBenchmarks { @@ -76,50 +75,47 @@ public: template <class ToDo> void ForEachBenchmarkRecord(ToDo & toDo) { - Platform & pl = GetPlatform(); - - string buffer; try { string configPath; - Settings::Get("BenchmarkConfig", configPath); - ReaderPtr<Reader>(pl.GetReader(configPath)).ReadAsString(buffer); - } - catch (RootException const & e) - { - LOG(LERROR, ("Error reading benchmarks: ", e.what())); - return; - } + if (!Settings::Get("BenchmarkConfig", configPath)) + return; - istringstream stream(buffer); + ReaderStreamBuf buffer(GetPlatform().GetReader(configPath)); + istream stream(&buffer); - string line; - while (stream.good()) - { - getline(stream, line); - - vector<string> parts; - strings::SimpleTokenizer it(line, " "); - while (it) + string line; + while (stream.good()) { - parts.push_back(*it); - ++it; - } + getline(stream, line); - if (!parts.empty()) - toDo(parts); + vector<string> parts; + strings::SimpleTokenizer it(line, " \t"); + while (it) + { + parts.push_back(*it); + ++it; + } + + if (!parts.empty()) + toDo(parts); + } + } + catch (RootException const & e) + { + LOG(LERROR, ("Error reading benchmarks: ", e.what())); } } struct MapsCollector { vector<string> m_maps; + void operator() (vector<string> const & v) { - if (!v[0].empty()) - if (v[0][0] == '#') - return; - m_maps.push_back(v[0]); + ASSERT(!v[0].empty(), ()); + if (v[0][0] != '#') + m_maps.push_back(v[0]); } }; @@ -130,6 +126,7 @@ void BenchmarkEngine::PrepareMaps() m_framework->GetLocalMaps(files); for_each(files.begin(), files.end(), bind(&Framework::RemoveMap, m_framework, _1)); + // add only maps needed for benchmarks MapsCollector collector; ForEachBenchmarkRecord(collector); @@ -180,7 +177,6 @@ void BenchmarkEngine::SaveBenchmarkResults() for (size_t i = 0; i < m_benchmarkResults.size(); ++i) { fout << GetPlatform().DeviceName() << " " - << VERSION_STRING << " " << m_startTime << " " << m_benchmarkResults[i].m_name << " " << m_benchmarkResults[i].m_rect.minX() << " " |