aboutsummaryrefslogtreecommitdiff
path: root/tests/benchmark-crypto-cipher.c
AgeCommit message (Collapse)Author
2021-03-12tests: Move benchmarks into a separate folderThomas Huth
Make it clear that these files are related to benchmarks by moving them into a new folder called "bench". Message-Id: <20210312092238.79509-1-thuth@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2020-09-10tests: fix output message formatting for crypto benchmarksDaniel P. Berrangé
The output was changed from g_print to g_test_message in commit 24441f912e67233d9c52ce6b459ed75de2484525 Author: Marc-André Lureau <marcandre.lureau@redhat.com> Date: Fri Aug 28 15:07:30 2020 +0400 tests: do not print benchmark output to stdout As this makes the TAP output invalid. Use g_test_message(). The functions do not result in equivalent output. The g_print statements were putting all the information on a single line for ease of interpretation. The change to g_test_message split the output across many lines making it painful to read. The opportunity is used to tweak the information printed to be more consistent across tests. Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-09-08tests: do not print benchmark output to stdoutMarc-André Lureau
As this makes the TAP output invalid. Use g_test_message(). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20200828110734.1638685-13-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-10-28tests: benchmark crypto with fixed data size, not time periodDaniel P. Berrangé
Currently the crypto benchmarks are processing data in varying chunk sizes, over a fixed time period. This turns out to be a terrible idea because with small chunk sizes the overhead of checking the elapsed time on each loop iteration masks the true performance. Benchmarking over a fixed data size avoids the loop running any system calls which can interfere with the performance measurements. Before this change Enc chunk 512 bytes 2283.47 MB/sec Dec chunk 512 bytes 2236.23 MB/sec OK Enc chunk 4096 bytes 2744.97 MB/sec Dec chunk 4096 bytes 2614.71 MB/sec OK Enc chunk 16384 bytes 2777.53 MB/sec Dec chunk 16384 bytes 2678.44 MB/sec OK Enc chunk 65536 bytes 2809.34 MB/sec Dec chunk 65536 bytes 2699.47 MB/sec OK After this change Enc chunk 512 bytes 2058.22 MB/sec Dec chunk 512 bytes 2030.11 MB/sec OK Enc chunk 4096 bytes 2699.27 MB/sec Dec chunk 4096 bytes 2573.78 MB/sec OK Enc chunk 16384 bytes 2748.52 MB/sec Dec chunk 16384 bytes 2653.76 MB/sec OK Enc chunk 65536 bytes 2814.08 MB/sec Dec chunk 65536 bytes 2712.74 MB/sec OK The actual crypto performance hasn't changed, which shows how significant the mis-measurement has been for small data sizes. Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-28tests: allow filtering crypto cipher benchmark testsDaniel P. Berrangé
Add support for specifying a cipher mode and chunk size as argv to filter which combinations are benchmarked. For example to only benchmark XTS mode with 512 byte chunks: ./tests/benchmark-crypto-cipher xts 512 Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-10-24crypto: expand algorithm coverage for cipher benchmarkDaniel P. Berrangé
Add testing coverage for AES with XTS, ECB and CTR modes Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-07-02tests/crypto: Use the IEC binary prefix definitionsPhilippe Mathieu-Daudé
It eases code review, unit is explicit. Patch generated using: $ git grep -n '[<>][<>]= ?[1-5]0' and modified manually. Suggested-by: Eric Blake <eblake@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180625124238.25339-45-f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-09-04tests: fix incorrect size_t format in benchmark-cryptoPhilippe Mathieu-Daudé
$ make check-speed tests/benchmark-crypto-hash.c: In function 'test_hash_speed': tests/benchmark-crypto-hash.c:44:5: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'size_t' [-Werror=format=] g_print("Testing chunk_size %ld bytes ", chunk_size); ^ tests/benchmark-crypto-hash.c: In function 'main': tests/benchmark-crypto-hash.c:62:9: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' [-Werror=format=] snprintf(name, sizeof(name), "/crypto/hash/speed-%lu", i); ^ cc1: all warnings being treated as errors rules.mak:66: recipe for target 'tests/benchmark-crypto-hash.o' failed make: *** [tests/benchmark-crypto-hash.o] Error 1 Reviewed-by: Longpeng(Mike) <longpeng@huawei.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-07-19tests: crypto: add cipher speed benchmark supportLongpeng(Mike)
Now we have two qcrypto backends, libiary-backend and afalg-backend, but which one is faster? This patch add a cipher speed benchmark, it helps us to measure the performance by using "make check-speed" or using "./tests/benchmark-crypto-cipher" directly. Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>