Search code examples
benchmarkingcrypto++

How can I run in Crypto++ library benchmarks test?


Can someone help me how can I run in Crypto++ benchmarks test?

I have to make some tests. I found Crypto++ but I don't know how use benchmarks test in Crypto++. I also want to run them after installing the library.

Thanks for help.


Solution

  • Can someone help me how can I run in Crypto++ benchmarks test?

    $ cd cryptopp-src
    $ make static cryptest.exe
    $ ./cryptest.exe b 3 2.76566 > benchmarks.html
    

    cryptest.exe takes three arguments: (1) b for benchmarks, (2) time for the length of each test, in seconds, and (3) freq for CPU frequency in GiHz. The example above, each test is run for 3 seconds. And the CPU is 2.8 GHz, which works out to be about 2.76566 GiHz.

    You can also do this little trick. It will produce a well-formed HTML page:

    $ CRYPTOPP_CPU_FREQ=2.76566 make bench
    

    IF you are using Crypto++ 5.6.5 or earlier, then use CRYPTOPP_CPU_SPEED. If you are using Crypto++ 6.0 or later, then use CRYPTOPP_CPU_FREQ.

    The output of the tests will look similar to Crypto++ 5.6.0 Benchmarks. It takes 5 or 10 minutes to produce the results.

    The source files of interest are test.cpp (handles the b option of cryptest.exe), bench1.cpp and bench2.cpp (implements the benchmarking based on algorithm).


    We recently added a wiki page covering Benchmarks. It discusses the basic stuff like how to run the benchmark suite. It also discusses how that portion of the library operates, like the way algorithms register themselves and how the benchmarks are timed. Also see Benchmarks on the Crypto++ wiki.