diff options
author | lloyd <[email protected]> | 2010-08-03 22:45:09 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-08-03 22:45:09 +0000 |
commit | 5d9eecf1646facfff9b20e9932894fce0d0ff39c (patch) | |
tree | 80a943a66eb4267d3a19db7278d1ba8c668a5715 /src/benchmark | |
parent | 657b633f51091a40ce8b1c7513d2b5a2731c9d46 (diff) | |
parent | 66b2ea0c063b69623ecf601027132f4a4ff366f5 (diff) |
merge of '28d57385c0f1a9a2665288ce728e8b3231634f59'
and 'a4d88442d5f6b8554234c7f7468856868919b614'
Diffstat (limited to 'src/benchmark')
-rw-r--r-- | src/benchmark/benchmark.cpp | 7 | ||||
-rw-r--r-- | src/benchmark/benchmark.h | 28 |
2 files changed, 28 insertions, 7 deletions
diff --git a/src/benchmark/benchmark.cpp b/src/benchmark/benchmark.cpp index 887c64e70..fc4a8ba37 100644 --- a/src/benchmark/benchmark.cpp +++ b/src/benchmark/benchmark.cpp @@ -120,9 +120,10 @@ bench_mac(MessageAuthenticationCode* mac, std::map<std::string, double> algorithm_benchmark(const std::string& name, - u32bit milliseconds, + Algorithm_Factory& af, RandomNumberGenerator& rng, - Algorithm_Factory& af) + u32bit milliseconds, + u32bit buf_size) { std::vector<std::string> providers = af.providers_of(name); std::map<std::string, double> all_results; @@ -133,7 +134,7 @@ algorithm_benchmark(const std::string& name, const u64bit ns_per_provider = (static_cast<u64bit>(milliseconds) * 1000 * 1000) / providers.size(); - std::vector<byte> buf(16 * 1024); + std::vector<byte> buf(buf_size * 1024); rng.randomize(&buf[0], buf.size()); for(u32bit i = 0; i != providers.size(); ++i) diff --git a/src/benchmark/benchmark.h b/src/benchmark/benchmark.h index 4f1d91b79..304fae2fc 100644 --- a/src/benchmark/benchmark.h +++ b/src/benchmark/benchmark.h @@ -18,16 +18,36 @@ namespace Botan { /** * Algorithm benchmark * @param name the name of the algorithm to test (cipher, hash, or MAC) -* @param milliseconds total time for the benchmark to run -* @param rng the rng to use to generate random inputs * @param af the algorithm factory used to create objects +* @param rng the rng to use to generate random inputs +* @param milliseconds total time for the benchmark to run +* @param buf_size size of buffer to benchmark against, in KiB * @return results a map from provider to speed in mebibytes per second */ std::map<std::string, double> BOTAN_DLL algorithm_benchmark(const std::string& name, - u32bit milliseconds, + Algorithm_Factory& af, RandomNumberGenerator& rng, - Algorithm_Factory& af); + u32bit milliseconds, + u32bit buf_size); + +/** +* Algorithm benchmark (1.8 compatability version) +* @deprecated Use variant taking buf_size defined above +* @param name the name of the algorithm to test (cipher, hash, or MAC) +* @param milliseconds total time for the benchmark to run +* @param rng the rng to use to generate random inputs +* @param af the algorithm factory used to create objects +* @return results a map from provider to speed in mebibytes per second +*/ +std::map<std::string, double> +inline algorithm_benchmark(const std::string& name, + u32bit milliseconds, + RandomNumberGenerator& rng, + Algorithm_Factory& af) + { + return algorithm_benchmark(name, af, rng, milliseconds, 16); + } } |