diff options
author | lloyd <[email protected]> | 2009-11-02 12:12:40 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-11-02 12:12:40 +0000 |
commit | b8658279904708d0690e473fb85942d5da23d2fc (patch) | |
tree | 65528378bd0089287ca0927a13a6e0a012f7bc78 /doc | |
parent | 6b617a55bd02bcc4fdb6f76af92e0cb65fd838a2 (diff) | |
parent | 92f31b22dfe2aa1b2bde84cbaf4ce7365fa4ec68 (diff) |
propagate from branch 'net.randombit.botan' (head 2773c2310e8c0a51975987a2dd6c5824c8d43882)
to branch 'net.randombit.botan.c++0x' (head f13cf5d7e89706c882604299b508f356c20aae3a)
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"; } } |