diff options
author | lloyd <[email protected]> | 2009-09-24 16:44:26 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-09-24 16:44:26 +0000 |
commit | 6cb4b06db7855fa8bec60b2965fe34fb01e5896c (patch) | |
tree | 4c99b8d613ce1551f2a27cda05e1d67988563072 /checks/check.cpp | |
parent | e06cb7dcf09e17cb0e76d42e096ca838c17a60bc (diff) |
Modify the self test program to use the builtin runtime benchmarking goop.
Features dropped: RNG benchmarking, the --bench-type option.
New feature: Anything the library understands can be benchmarked using
--bench-algo.
Use 3DES and Serpent for mode benchmarking along with AES-128.
Diffstat (limited to 'checks/check.cpp')
-rw-r--r-- | checks/check.cpp | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/checks/check.cpp b/checks/check.cpp index 30ee90d98..b460d34f7 100644 --- a/checks/check.cpp +++ b/checks/check.cpp @@ -111,8 +111,6 @@ int main(int argc, char* argv[]) << "Options:\n" << " --test || --validate: Run tests (do this at least once)\n" << " --benchmark: Benchmark everything\n" - << " --bench-type={block,mode,stream,hash,mac,rng,pk}:\n" - << " Benchmark only algorithms of a particular type\n" << " --seconds=n: Benchmark for n seconds\n" << " --init=<str>: Pass <str> to the library\n" << " --help: Print this message\n"; @@ -127,7 +125,7 @@ int main(int argc, char* argv[]) opts.is_set("benchmark") || opts.is_set("bench-type")) { - double seconds = 5; + double seconds = 2; if(opts.is_set("seconds")) { @@ -141,7 +139,7 @@ int main(int argc, char* argv[]) if(opts.is_set("benchmark")) { - benchmark("All", rng, seconds); + benchmark(rng, seconds); } else if(opts.is_set("bench-algo")) { @@ -151,34 +149,10 @@ int main(int argc, char* argv[]) for(u32bit j = 0; j != algs.size(); j++) { const std::string alg = algs[j]; - u32bit found = bench_algo(alg, rng, seconds); - if(!found) // maybe it's a PK algorithm + if(!bench_algo(alg, rng, seconds)) // maybe it's a PK algorithm bench_pk(rng, alg, seconds); } } - else if(opts.is_set("bench-type")) - { - const std::string type = opts.value("bench-type"); - - if(type == "all") - benchmark("All", rng, seconds); - else if(type == "block") - benchmark("Block Cipher", rng, seconds); - else if(type == "stream") - benchmark("Stream Cipher", rng, seconds); - else if(type == "hash") - benchmark("Hash", rng, seconds); - else if(type == "mode") - benchmark("Cipher Mode", rng, seconds); - else if(type == "mac") - benchmark("MAC", rng, seconds); - else if(type == "rng") - benchmark("RNG", rng, seconds); - else if(type == "pk") - bench_pk(rng, "All", seconds); - else - std::cerr << "Unknown --bench-type " << type << "\n"; - } } } catch(std::exception& e) |