Skip to content

Commit 524354b

Browse files
Merge pull request #982 from lplewa/fix_iter
set fixed iteration count for benchmarks
2 parents 9bf1316 + 6f274ec commit 524354b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

benchmark/benchmark.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ struct alloc_data {
9595
->ArgNames( \
9696
BENCHMARK_PRIVATE_CONCAT_NAME(BaseClass, Method)::argsName()) \
9797
->Name(BENCHMARK_PRIVATE_CONCAT_NAME(BaseClass, Method)::name()) \
98-
->MinWarmUpTime(1)
98+
->Iterations( \
99+
BENCHMARK_PRIVATE_CONCAT_NAME(BaseClass, Method)::iterations())
99100

100101
class fixed_alloc_size : public alloc_size_interface {
101102
public:
@@ -238,6 +239,7 @@ class alloc_benchmark : public benchmark_interface<Size, Alloc> {
238239
return res;
239240
}
240241
static std::string name() { return base::name() + "/alloc"; }
242+
static int64_t iterations() { return 200000; }
241243

242244
protected:
243245
using base = benchmark_interface<Size, Alloc>;
@@ -324,6 +326,7 @@ class multiple_malloc_free_benchmark : public alloc_benchmark<Size, Alloc> {
324326
res.insert(res.end(), n.begin(), n.end());
325327
return res;
326328
}
329+
static int64_t iterations() { return 2000; }
327330
std::default_random_engine generator;
328331
distribution dist;
329332
};

benchmark/benchmark_interfaces.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct benchmark_interface : public benchmark::Fixture {
5555
return res;
5656
}
5757
static std::string name() { return Allocator::name(); }
58-
58+
static int64_t iterations() { return 10000; }
5959
Size alloc_size;
6060
Allocator allocator;
6161
};

0 commit comments

Comments
 (0)