diff options
author | lloyd <[email protected]> | 2013-05-30 17:36:31 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2013-05-30 17:36:31 +0000 |
commit | 8a2ce8d1dd2eda91f6e3eb56c3082e01b0d40eff (patch) | |
tree | 469806099036e389439f9a61f9a3e04f3ce38939 /src/benchmark | |
parent | fcdfb64b622464201ff72d4ab8e56660bb9c95ec (diff) |
Avoid SIGFPE if no providers during benchmark
Diffstat (limited to 'src/benchmark')
-rw-r--r-- | src/benchmark/benchmark.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/benchmark/benchmark.cpp b/src/benchmark/benchmark.cpp index 771654234..83fd87d1b 100644 --- a/src/benchmark/benchmark.cpp +++ b/src/benchmark/benchmark.cpp @@ -145,14 +145,18 @@ algorithm_benchmark(const std::string& name, size_t buf_size) { const std::vector<std::string> providers = af.providers_of(name); - const std::chrono::nanoseconds ns_per_provider = milliseconds / providers.size(); std::map<std::string, double> all_results; // provider -> ops/sec - for(auto provider : providers) + if(!providers.empty()) { - auto results = time_algorithm_ops(name, af, provider, rng, ns_per_provider, buf_size); - all_results[provider] = find_first_in(results, { "", "update", "encrypt" }); + const std::chrono::nanoseconds ns_per_provider = milliseconds / providers.size(); + + for(auto provider : providers) + { + auto results = time_algorithm_ops(name, af, provider, rng, ns_per_provider, buf_size); + all_results[provider] = find_first_in(results, { "", "update", "encrypt" }); + } } return all_results; |