-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintbench.cc
48 lines (35 loc) · 1.21 KB
/
intbench.cc
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
// Copyright (c) 2019 Vicente Romero Calero. All rights reserved.
// Licensed under the MIT License.
// See LICENSE file in the project root for full license information.
#include <iostream>
#include <string>
#include "common.h"
#include "benchmark/include/benchmark/benchmark.h"
void ParseArguments(int argc, char** argv) {
const std::string dataDirFlag = std::string("--data-dir=");
for (int i = 1; i < argc; ++i) {
std::string opt(argv[i]);
if (dataDirFlag.compare(opt.substr(0, dataDirFlag.length())) == 0) {
GlobalState::dataDirectory = std::string(opt.substr(dataDirFlag.length()));
}
}
}
void Usage(const std::string& programName) {
std::cerr << "Usage: " << programName << " --data-dir=DIRPATH [BENCHMARK_OPTIONS]" << std::endl;
}
int main(int argc, char** argv) {
if (argc < 2) {
Usage(std::string(argv[0]));
return 1;
}
ParseArguments(argc, argv);
if (GlobalState::dataDirectory.empty()) {
std::cerr << "--data-dir argument not provided" << std::endl;
Usage(std::string(argv[0]));
return 1;
}
std::cout << "Data directory: " << GlobalState::dataDirectory << std::endl;
benchmark::Initialize(&argc, argv);
benchmark::RunSpecifiedBenchmarks();
return 0;
}