aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/misc
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2015-08-20 19:49:31 +0200
committerSimon Warta <[email protected]>2015-08-21 00:50:28 +0200
commit5bedae43e66002aefadce0b6d43bf6791d5156ca (patch)
tree859e7915f4bbb2fa50f449e6e755856670cc8773 /src/lib/misc
parenta59f013165776fc57eb2b2bfd8aff95d536d2016 (diff)
Refactor ./botan speed
* Add random_prime benchmark * Add is_prime benchmark * Respect runtime in benchmark_transform(). This sets default runtime from 2s to 0.5s per configuration
Diffstat (limited to 'src/lib/misc')
-rw-r--r--src/lib/misc/benchmark/benchmark.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/misc/benchmark/benchmark.cpp b/src/lib/misc/benchmark/benchmark.cpp
index 90d8b1aca..152b45d37 100644
--- a/src/lib/misc/benchmark/benchmark.cpp
+++ b/src/lib/misc/benchmark/benchmark.cpp
@@ -6,6 +6,7 @@
*/
#include <botan/benchmark.h>
+#include <botan/exceptn.h>
#include <botan/lookup.h>
#include <botan/buf_comp.h>
#include <botan/cipher_mode.h>
@@ -153,19 +154,18 @@ algorithm_benchmark(const std::string& name,
size_t buf_size)
{
//Algorithm_Factory& af = global_state().algorithm_factory();
- const auto providers = get_all_providers_of(name);
+ const auto provider_names = get_all_providers_of(name);
+ if (provider_names.empty())
+ throw No_Provider_Found(name);
std::map<std::string, double> all_results; // provider -> ops/sec
- if(!providers.empty())
- {
- const std::chrono::nanoseconds ns_per_provider = milliseconds / providers.size();
+ const std::chrono::nanoseconds ns_per_provider = milliseconds / provider_names.size();
- for(auto provider : providers)
- {
- auto results = time_algorithm_ops(name, provider, rng, ns_per_provider, buf_size);
- all_results[provider] = find_first_in(results, { "", "update", "encrypt" });
- }
+ for(auto provider : provider_names)
+ {
+ auto results = time_algorithm_ops(name, provider, rng, ns_per_provider, buf_size);
+ all_results[provider] = find_first_in(results, { "", "update", "encrypt" });
}
return all_results;