diff options
author | lloyd <[email protected]> | 2009-09-30 18:03:46 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-09-30 18:03:46 +0000 |
commit | ce2c86429a5b69ff059205f348732b7fbf4eafc8 (patch) | |
tree | d9389731c8a6cbd7c3dc6b6082ea598459cfdb12 /doc | |
parent | 59b4eb0bd2d1b9d65c3921f5205a012f1a98fdf8 (diff) | |
parent | d5c7febf558af0f7a6f0edf3595d55fe04dce0f5 (diff) |
propagate from branch 'net.randombit.botan' (head 8a5eb02c2e451fc983f234f7ba2f023f5a7d294f)
to branch 'net.randombit.botan.c++0x' (head e18cd411269e15638df3298d6a4165446e7ca529)
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"; } } |