summaryrefslogtreecommitdiffhomepage
path: root/bench/main.cpp
blob: 5fccf3e45db15e163f6e17b15b100b388f3c641b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "loader/loader.hpp"
#include "compat/headless.hpp"
#include <benchmark/benchmark.h>

namespace floormat {

namespace {

#define main bench_main
int bench_main(int argc, char** argv);
BENCHMARK_MAIN();
#undef main

struct bench_app final : private FM_APPLICATION
{
    using Application = FM_APPLICATION;
    explicit bench_app(int argc, char** argv);

    int exec() override;
    ~bench_app();

    int argc;
    char** argv;
};
bench_app::~bench_app() { loader.destroy(); }

int argc_ = 0; // NOLINT

bench_app::bench_app(int argc, char** argv) :
    Application {
        {argc_, nullptr},
        Configuration{}.setFlags(Configuration::Flag::QuietLog)
    },
    argc{argc}, argv{argv}
{
}

int bench_app::exec()
{
    return bench_main(argc, argv);
}

} // namespace

} // namespace floormat

using namespace floormat;

int main(int argc, char** argv)
{
    int status;
    {   auto app = bench_app{argc, argv};
        status = app.exec();
    }
    loader.destroy();
    return status;
}