diff options
author | lloyd <[email protected]> | 2009-10-13 16:05:37 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-10-13 16:05:37 +0000 |
commit | 6f68dc5485ebd41fdef837ab651a47a893d84408 (patch) | |
tree | 3cda82570052b7bed24df2754c2245479188488a /doc | |
parent | 9268a0455a07d31a66364aa5b7594bd75250b466 (diff) | |
parent | 1b0448fae6652a2da7f0de1fdcd2bbcda9836ca9 (diff) |
propagate from branch 'net.randombit.botan' (head 139d6957d20f0b1202e0eacc63cb011588faffde)
to branch 'net.randombit.botan.c++0x' (head c16676fa6c393bc3f46a044755ce525a013380a6)
Diffstat (limited to 'doc')
-rw-r--r-- | doc/examples/bench.cpp | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/doc/examples/bench.cpp b/doc/examples/bench.cpp index cc43fade0..db2170dc4 100644 --- a/doc/examples/bench.cpp +++ b/doc/examples/bench.cpp @@ -63,37 +63,27 @@ const std::string algos[] = { void benchmark_algo(const std::string& algo, RandomNumberGenerator& rng) { - u32bit milliseconds = 3000; - Default_Benchmark_Timer timer; - Algorithm_Factory& af = global_state().algorithm_factory(); + LibraryInitializer init; - std::map<std::string, double> speeds = - algorithm_benchmark(algo, milliseconds, timer, rng, af); + u32bit milliseconds = 1000; + AutoSeeded_RNG rng; - std::cout << algo << ":"; + Algorithm_Factory& af = global_state().algorithm_factory(); - for(std::map<std::string, double>::const_iterator i = speeds.begin(); - i != speeds.end(); ++i) + for(u32bit i = 0; algos[i] != ""; ++i) { - std::cout << " " << i->second << " [" << i->first << "]"; - } - std::cout << "\n"; - } + std::string algo = algos[i]; -int main(int argc, char* argv[]) - { - LibraryInitializer init; + std::map<std::string, double> speeds = + algorithm_benchmark(algos[i], milliseconds, rng, af); - AutoSeeded_RNG rng; + std::cout << algo << ":"; - if(argc == 1) // no args, benchmark everything - { - for(u32bit i = 0; algos[i] != ""; ++i) - benchmark_algo(algos[i], rng); - } - else - { - for(int i = 1; argv[i]; ++i) - benchmark_algo(argv[i], rng); + for(std::map<std::string, double>::const_iterator i = speeds.begin(); + i != speeds.end(); ++i) + { + std::cout << " " << i->second << " [" << i->first << "]"; + } + std::cout << "\n"; } } |