-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhistogram.cpp
More file actions
27 lines (22 loc) · 768 Bytes
/
Copy pathhistogram.cpp
File metadata and controls
27 lines (22 loc) · 768 Bytes
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
#include "histogram-common.hpp"
#include <vector>
int main(int argc, char** argv) {
return guarded_main([&]() {
const Config config = parse_args(argc, argv);
if (config.num_threads != 1) {
throw std::invalid_argument(
"The sequential baseline requires --num-threads 1");
}
std::vector<std::uint64_t> bins(config.max_value + 1, 0);
const auto start = Clock::now();
generate_and_add(
config.sample_size,
config.max_value,
config.seed,
0,
[&](std::size_t value) { ++bins[value]; });
const auto end = Clock::now();
print_result(config, bins, elapsed_seconds(start, end));
return EXIT_SUCCESS;
});
}