MCPcopy Create free account
hub / github.com/comaps/comaps / RunBenchmark

Function RunBenchmark

libs/map/benchmark_tool/features_loading.cpp:63–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61};
62
63void RunBenchmark(FeaturesFetcher const & src, m2::RectD const & rect, pair<int, int> const & scaleRange,
64 AllResult & res)
65{
66 ASSERT_LESS_OR_EQUAL(scaleRange.first, scaleRange.second, ());
67
68 vector<m2::RectD> rects;
69 rects.push_back(rect);
70
71 Accumulator acc(res.m_reading);
72
73 while (!rects.empty())
74 {
75 m2::RectD const r = rects.back();
76 rects.pop_back();
77
78 bool doDivide = true;
79 int const scale = scales::GetScaleLevel(r);
80 if (scale >= scaleRange.first)
81 {
82 acc.Reset(scale);
83
84 base::Timer timer;
85 src.ForEachFeature(r, acc, scale);
86 res.Add(timer.ElapsedSeconds());
87
88 doDivide = !acc.IsEmpty();
89 }
90
91 if (doDivide && scale < scaleRange.second)
92 {
93 m2::RectD r1, r2;
94 r.DivideByGreaterSize(r1, r2);
95 rects.push_back(r1);
96 rects.push_back(r2);
97 }
98 }
99}
100} // namespace
101
102void RunFeaturesLoadingBenchmark(string fileName, pair<int, int> scaleRange, AllResult & res)

Callers 1

Calls 11

GetScaleLevelFunction · 0.85
backMethod · 0.80
ElapsedSecondsMethod · 0.80
DivideByGreaterSizeMethod · 0.80
push_backMethod · 0.45
emptyMethod · 0.45
pop_backMethod · 0.45
ResetMethod · 0.45
ForEachFeatureMethod · 0.45
AddMethod · 0.45
IsEmptyMethod · 0.45

Tested by

no test coverage detected