libdballe  7.6
bench.h
1 /*
2  * Copyright (C) 2015 ARPA-SIM <urpsim@smr.arpa.emr.it>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16  *
17  * Author: Enrico Zini <enrico@enricozini.com>
18  */
19 #ifndef DBALLE_DB_BENCH_UTILS_H
20 #define DBALLE_DB_BENCH_UTILS_H
21 
22 #include <wreport/benchmark.h>
23 #include <dballe/db/db.h>
24 
25 namespace dballe {
26 namespace bench {
27 
28 struct DBBenchmark : wreport::benchmark::Benchmark
29 {
30  using wreport::benchmark::Benchmark::Benchmark;
31 
32  std::unique_ptr<DB> db;
33 
34  void setup_main() override
35  {
36  db = DB::connect_test();
37  db->reset();
38  }
39 
40  void teardown_main() override
41  {
42  db->disappear();
43  db.reset(0);
44  }
45 
46  void setup_iteration()
47  {
48  db->remove_all();
49  }
50 };
51 
52 }
53 }
54 
55 #endif
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
Definition: bench.h:28
Functions used to connect to DB-All.e and insert, query and delete data.
static std::unique_ptr< DB > connect_test()
Start a test session with DB-All.e.