20 #include <mysql/testutils/mysql_schema.h>
39 void SetUp(::benchmark::State
const&)
override {
43 LeaseMgrFactory::destroy();
44 LeaseMgrFactory::create(validMySQLConnectionString());
46 cerr <<
"ERROR: unable to open database" << endl;
49 lmptr_ = &(LeaseMgrFactory::instance());
52 void SetUp(::benchmark::State& s)
override {
53 ::benchmark::State
const& cs = s;
58 void TearDown(::benchmark::State
const&)
override {
62 cerr <<
"WARNING: rollback has failed, this is expected if database"
63 " is opened in read-only mode, continuing..."
66 LeaseMgrFactory::destroy();
71 void TearDown(::benchmark::State& s)
override {
72 ::benchmark::State
const& cs = s;
78 BENCHMARK_DEFINE_F(MySqlLeaseMgrBenchmark, insertLeases4)(benchmark::State& state) {
79 const size_t lease_count = state.range(0);
80 while (state.KeepRunning()) {
81 setUp4(state, lease_count);
87 BENCHMARK_DEFINE_F(MySqlLeaseMgrBenchmark, updateLeases4)(benchmark::State& state) {
88 const size_t lease_count = state.range(0);
89 while (state.KeepRunning()) {
90 setUpWithInserts4(state, lease_count);
96 BENCHMARK_DEFINE_F(MySqlLeaseMgrBenchmark, getLease4_address)(benchmark::State& state) {
97 const size_t lease_count = state.range(0);
98 while (state.KeepRunning()) {
99 setUpWithInserts4(state, lease_count);
100 benchGetLease4_address();
105 BENCHMARK_DEFINE_F(MySqlLeaseMgrBenchmark, getLease4_hwaddr)(benchmark::State& state) {
106 const size_t lease_count = state.range(0);
107 while (state.KeepRunning()) {
108 setUpWithInserts4(state, lease_count);
109 benchGetLease4_hwaddr();
115 BENCHMARK_DEFINE_F(MySqlLeaseMgrBenchmark, getLease4_hwaddr_subnetid)(benchmark::State& state) {
116 const size_t lease_count = state.range(0);
117 while (state.KeepRunning()) {
118 setUpWithInserts4(state, lease_count);
119 benchGetLease4_hwaddr_subnetid();
124 BENCHMARK_DEFINE_F(MySqlLeaseMgrBenchmark, getLease4_clientid)(benchmark::State& state) {
125 const size_t lease_count = state.range(0);
126 while (state.KeepRunning()) {
127 setUpWithInserts4(state, lease_count);
128 benchGetLease4_clientid();
134 BENCHMARK_DEFINE_F(MySqlLeaseMgrBenchmark, getLease4_clientid_subnetid)(benchmark::State& state) {
135 const size_t lease_count = state.range(0);
136 while (state.KeepRunning()) {
137 setUpWithInserts4(state, lease_count);
138 benchGetLease4_clientid_subnetid();
143 BENCHMARK_DEFINE_F(MySqlLeaseMgrBenchmark, getExpiredLeases4)(benchmark::State& state) {
144 const size_t lease_count = state.range(0);
145 while (state.KeepRunning()) {
146 setUpWithInserts4(state, lease_count);
147 benchGetExpiredLeases4();
152 BENCHMARK_DEFINE_F(MySqlLeaseMgrBenchmark, insertLeases6)(benchmark::State& state) {
153 const size_t lease_count = state.range(0);
154 while (state.KeepRunning()) {
155 setUp6(state, lease_count);
156 benchInsertLeases6();
161 BENCHMARK_DEFINE_F(MySqlLeaseMgrBenchmark, updateLeases6)(benchmark::State& state) {
162 const size_t lease_count = state.range(0);
163 while (state.KeepRunning()) {
164 setUpWithInserts6(state, lease_count);
165 benchUpdateLeases6();
170 BENCHMARK_DEFINE_F(MySqlLeaseMgrBenchmark, getLease6_type_address)(benchmark::State& state) {
171 const size_t lease_count = state.range(0);
172 while (state.KeepRunning()) {
173 setUpWithInserts6(state, lease_count);
174 benchGetLease6_type_address();
179 BENCHMARK_DEFINE_F(MySqlLeaseMgrBenchmark, getLease6_type_duid_iaid)(benchmark::State& state) {
180 const size_t lease_count = state.range(0);
181 while (state.KeepRunning()) {
182 setUpWithInserts6(state, lease_count);
183 benchGetLease6_type_duid_iaid();
189 BENCHMARK_DEFINE_F(MySqlLeaseMgrBenchmark, getLease6_type_duid_iaid_subnetid)
190 (benchmark::State& state) {
191 const size_t lease_count = state.range(0);
192 while (state.KeepRunning()) {
193 setUpWithInserts6(state, lease_count);
194 benchGetLease6_type_duid_iaid_subnetid();
199 BENCHMARK_DEFINE_F(MySqlLeaseMgrBenchmark, getExpiredLeases6)(benchmark::State& state) {
200 const size_t lease_count = state.range(0);
201 while (state.KeepRunning()) {
202 setUpWithInserts6(state, lease_count);
203 benchGetExpiredLeases6();
211 BENCHMARK_REGISTER_F(MySqlLeaseMgrBenchmark, insertLeases4)
215 BENCHMARK_REGISTER_F(MySqlLeaseMgrBenchmark, updateLeases4)
219 BENCHMARK_REGISTER_F(MySqlLeaseMgrBenchmark, getLease4_address)
223 BENCHMARK_REGISTER_F(MySqlLeaseMgrBenchmark, getLease4_hwaddr)
228 BENCHMARK_REGISTER_F(MySqlLeaseMgrBenchmark, getLease4_hwaddr_subnetid)
232 BENCHMARK_REGISTER_F(MySqlLeaseMgrBenchmark, getLease4_clientid)
236 BENCHMARK_REGISTER_F(MySqlLeaseMgrBenchmark, getLease4_clientid_subnetid)
240 BENCHMARK_REGISTER_F(MySqlLeaseMgrBenchmark, getExpiredLeases4)
244 BENCHMARK_REGISTER_F(MySqlLeaseMgrBenchmark, insertLeases6)
248 BENCHMARK_REGISTER_F(MySqlLeaseMgrBenchmark, updateLeases6)
252 BENCHMARK_REGISTER_F(MySqlLeaseMgrBenchmark, getLease6_type_address)
256 BENCHMARK_REGISTER_F(MySqlLeaseMgrBenchmark, getLease6_type_duid_iaid)
261 BENCHMARK_REGISTER_F(MySqlLeaseMgrBenchmark, getLease6_type_duid_iaid_subnetid)
265 BENCHMARK_REGISTER_F(MySqlLeaseMgrBenchmark, getExpiredLeases6)
constexpr benchmark::TimeUnit UNIT
A time unit used - all results to be expressed in us (microseconds)
constexpr size_t MAX_LEASE_COUNT
A maximum number of leases used in a benchmark.
A base class for a fixture for specific lease manager benchmarks.
constexpr size_t MIN_LEASE_COUNT
A minimum number of leases used in a benchmark.