1 /* 2 * (C) 2009 Jack Lloyd 3 * 4 * Distributed under the terms of the Botan license 5 */ 6 7 #include <botan/botan.h> 8 #include <botan/benchmark.h> 9 10 #include <iostream> 11 #include <string> 12 #include <map> 13 #include <cstdlib> 14 main(int argc,char * argv[])15int main(int argc, char* argv[]) 16 { 17 if(argc <= 2) 18 { 19 std::cout << "Usage: " << argv[0] << " seconds <algo1> <algo2> ...\n"; 20 return 1; 21 } 22 23 Botan::LibraryInitializer init; 24 25 Botan::AutoSeeded_RNG rng; 26 27 Botan::Algorithm_Factory& af = Botan::global_state().algorithm_factory(); 28 29 double ms = 1000 * std::atof(argv[1]); 30 31 for(size_t i = 2; argv[i]; ++i) 32 { 33 std::string algo = argv[i]; 34 35 std::map<std::string, double> results = 36 algorithm_benchmark(algo, af, rng, ms, 16); 37 38 std::cout << algo << ":\n"; 39 for(std::map<std::string, double>::iterator r = results.begin(); 40 r != results.end(); ++r) 41 { 42 std::cout << " " << r->first << ": " << r->second << " MiB/s\n"; 43 } 44 std::cout << "\n"; 45 } 46 } 47