18 _latency_params(std::make_tuple(0, 0, 0)),
69 if ((from > 0) && (to > 0))
74 for (
int i = from; i <= to; ++i)
75 _threads.emplace_back(i);
82 if ((from > 0) && (to > 0) && selector)
89 int result = selector(from, to, current);
90 while ((result >= from) && (result <= to))
92 _threads.emplace_back(result);
95 result = selector(from, to, current);
103 if ((producers > 0) && (consumers > 0))
104 _pc.emplace_back(producers, consumers);
110 if ((producers_from > 0) && (producers_to > 0) && (consumers_from > 0) && (consumers_to > 0))
112 if (producers_from > producers_to)
113 std::swap(producers_from, producers_to);
115 if (consumers_from > consumers_to)
116 std::swap(consumers_from, consumers_to);
118 for (
int i = producers_from; i <= producers_to; ++i)
119 for (
int j = consumers_from; j <= consumers_to; ++j)
120 _pc.emplace_back(i, j);
126 int consumers_from,
int consumers_to,
const std::function<
int (
int,
int,
int&)>& consumers_selector)
128 if ((producers_from > 0) && (producers_to > 0) && (consumers_from > 0) && (consumers_to > 0) && producers_selector && consumers_selector)
130 if (producers_from > producers_to)
131 std::swap(producers_from, producers_to);
133 if (consumers_from > consumers_to)
134 std::swap(consumers_from, consumers_to);
137 int current1 = producers_from;
138 int result1 = producers_selector(producers_from, producers_to, current1);
139 while ((result1 >= producers_from) && (result1 <= producers_to))
142 int current2 = consumers_from;
143 int result2 = consumers_selector(consumers_from, consumers_to, current2);
144 while ((result2 >= consumers_from) && (result2 <= consumers_to))
146 _pc.emplace_back(result1, result2);
149 result2 = consumers_selector(consumers_from, consumers_to, current2);
153 result1 = producers_selector(producers_from, producers_to, current1);
162 _params.emplace_back(value, -1, -1);
168 if ((from >= 0) && (to >= 0))
173 for (
int i = from; i <= to; ++i)
174 _params.emplace_back(i, -1, -1);
181 if ((from >= 0) && (to >= 0) && selector)
188 int result = selector(from, to, current);
189 while ((result >= from) && (result <= to))
191 _params.emplace_back(result, -1, -1);
194 result = selector(from, to, current);
202 if ((value1 >= 0) && (value2 >= 0))
203 _params.emplace_back(value1, value2, -1);
209 if ((from1 >= 0) && (to1 >= 0) && (from2 >= 0) && (to2 >= 0))
212 std::swap(from1, to1);
215 std::swap(from2, to2);
217 for (
int i = from1; i <= to1; ++i)
218 for (
int j = from2; j <= to2; ++j)
219 _params.emplace_back(i, j, -1);
225 int from2,
int to2,
const std::function<
int (
int,
int,
int&)>& selector2)
227 if ((from1 >= 0) && (to1 >= 0) && (from2 >= 0) && (to2 >= 0) && selector1 && selector2)
230 std::swap(from1, to1);
233 std::swap(from2, to2);
236 int current1 = from1;
237 int result1 = selector1(from1, to1, current1);
238 while ((result1 >= from1) && (result1 <= to1))
241 int current2 = from2;
242 int result2 = selector2(from2, to2, current2);
243 while ((result2 >= from2) && (result2 <= to2))
245 _params.emplace_back(result1, result2, -1);
248 result2 = selector2(from2, to2, current2);
252 result1 = selector1(from1, to1, current1);
260 if ((value1 >= 0) && (value2 >= 0) && (value3 >= 0))
261 _params.emplace_back(value1, value2, value3);
267 if ((from1 >= 0) && (to1 >= 0) && (from2 >= 0) && (to2 >= 0) && (from3 >= 0) && (to3 >= 0))
270 std::swap(from1, to1);
273 std::swap(from2, to2);
276 std::swap(from3, to3);
278 for (
int i = from1; i <= to1; ++i)
279 for (
int j = from2; j <= to2; ++j)
280 for (
int k = from3; k <= to3; ++k)
281 _params.emplace_back(i, j, k);
287 int from2,
int to2,
const std::function<
int (
int,
int,
int&)>& selector2,
288 int from3,
int to3,
const std::function<
int (
int,
int,
int&)>& selector3)
290 if ((from1 >= 0) && (to1 >= 0) && (from2 >= 0) && (to2 >= 0) && (from3 >= 0) && (to3 >= 0) && selector1 && selector2 && selector3)
293 std::swap(from1, to1);
296 std::swap(from2, to2);
299 std::swap(from3, to3);
302 int current1 = from1;
303 int result1 = selector1(from1, to1, current1);
304 while ((result1 >= from1) && (result1 <= to1))
307 int current2 = from2;
308 int result2 = selector2(from2, to2, current2);
309 while ((result2 >= from2) && (result2 <= to2))
312 int current3 = from3;
313 int result3 = selector3(from3, to3, current3);
314 while ((result3 >= from3) && (result3 <= to3))
316 _params.emplace_back(result1, result2, result3);
319 result3 = selector3(from3, to3, current3);
323 result2 = selector2(from2, to2, current2);
327 result1 = selector1(from1, to1, current1);
335 _latency_params = std::make_tuple(lowest, highest, significant);
336 _latency_auto = automatic;
Settings & ParamRange(int from, int to)
Add new single parameter range to the benchmark running plan.
Settings & Attempts(int attempts)
Set independent benchmark attempts.
Settings & ThreadsRange(int from, int to)
Add new threads range to the benchmark running plan.
Settings & Threads(int threads)
Add new threads count to the benchmark running plan.
Settings & Triple(int value1, int value2, int value3)
Add new parameters triple to the benchmark running plan.
Settings & PC(int producers, int consumers)
Add new producers/consumers count to the benchmark running plan.
int attempts() const noexcept
Get count of independent benchmark attempts.
Settings & Infinite()
Set infinite benchmark operations flag.
int64_t duration() const noexcept
Get benchmark duration in milliseconds.
Settings & Operations(int64_t operations)
Set count of operations.
Settings & PairRange(int from1, int to1, int from2, int to2)
Add new parameters pairs range to the benchmark running plan.
Settings & Latency(int64_t lowest, int64_t highest, int significant, bool automatic=true)
Set latency histogram parameters.
Settings & TripleRange(int from1, int to1, int from2, int to2, int from3, int to3)
Add new parameters triple range to the benchmark running plan.
int64_t operations() const noexcept
Get count of operations.
Settings & PCRange(int producers_from, int producers_to, int consumers_from, int consumers_to)
Add new producers/consumers range to the benchmark running plan.
Settings & Duration(int64_t duration)
Set benchmark duration in seconds.
Settings & Pair(int value1, int value2)
Add new parameters pair to the benchmark running plan.
Settings()
Initialize settings with the default benchmark duration (5 seconds)
Settings & Param(int value)
Add new single parameter to the benchmark running plan.
const std::vector< int > & threads() const noexcept
Get collection of independent threads counts in a benchmark plan.
C++ Benchmark project definitions.
Benchmark settings definition.