diff options
author | lloyd <[email protected]> | 2009-11-19 17:35:33 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-11-19 17:35:33 +0000 |
commit | 46eb21cd08a0268d860eeef449e7474fb615b050 (patch) | |
tree | 029d5bdea51f1606ecb6f241c5964881b98b1d5f /doc/examples/bench.cpp | |
parent | ac3db1c524fdecbc069a5e1323d93e4a3b933152 (diff) | |
parent | 2af8cfbaf23033250a6819be9f45f82bf03e898d (diff) |
propagate from branch 'net.randombit.botan' (head 2f3665f775fafbdfa517ecdca7f872e35bd90277)
to branch 'net.randombit.botan.c++0x' (head 45169719ddd8977b1eb20637576bc855dbc867a0)
Diffstat (limited to 'doc/examples/bench.cpp')
-rw-r--r-- | doc/examples/bench.cpp | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/doc/examples/bench.cpp b/doc/examples/bench.cpp index cc43fade0..7d53e0557 100644 --- a/doc/examples/bench.cpp +++ b/doc/examples/bench.cpp @@ -60,40 +60,29 @@ const std::string algos[] = { "", }; -void benchmark_algo(const std::string& algo, - RandomNumberGenerator& rng) +int main() { - 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"; } } |