aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-09-12 21:17:22 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-09-12 21:17:22 +0100
commitc47edb8dda0660180f86df4defae2a1f60e345db (patch)
treedbba6763cf3e71dbd08a0e2990ff8603ed2f88f7 /tests
parent842038f55c69673d2983f269be2845e8e18cda05 (diff)
parent1b010d9339497b081c3b8ab4f98b2a21f2cae08d (diff)
downloadqemu-c47edb8dda0660180f86df4defae2a1f60e345db.zip
qemu-c47edb8dda0660180f86df4defae2a1f60e345db.tar.gz
qemu-c47edb8dda0660180f86df4defae2a1f60e345db.tar.bz2
Merge remote-tracking branch 'remotes/berrange-gitlab/tags/crypt-perf-pull-request' into staging
Improve performance of crypto cipher subsystem # gpg: Signature made Thu 10 Sep 2020 11:05:18 BST # gpg: using RSA key DAF3A6FDB26B62912D0E8E3FBE86EBB415104FDF # gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" [full] # gpg: aka "Daniel P. Berrange <berrange@redhat.com>" [full] # Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E 8E3F BE86 EBB4 1510 4FDF * remotes/berrange-gitlab/tags/crypt-perf-pull-request: crypto/gcrypt: Split QCryptoCipherGcrypt into subclasses crypto/nettle: Split QCryptoCipherNettle into subclasses crypto/builtin: Split QCryptoCipherBuiltin into subclasses crypto/builtin: Split and simplify AES_encrypt_cbc crypto/builtin: Move AES_cbc_encrypt into cipher-builtin.inc.c crypto/builtin: Merge qcrypto_cipher_aes_{ecb,xts}_{en,de}crypt crypto/builtin: Remove odd-sized AES block handling crypto: Constify cipher data tables crypto: Move cipher->driver init to qcrypto_*_cipher_ctx_new crypto: Allocate QCryptoCipher with the subclass crypto: Use the correct const type for driver crypto: Move QCryptoCipherDriver typedef to crypto/cipher.h crypto/nettle: Fix xts_encrypt arguments crypto: Remove redundant includes crypto: Rename cipher include files to .c.inc crypto: Assume blocksize is a power of 2 tests: fix output message formatting for crypto benchmarks Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/benchmark-crypto-cipher.c12
-rw-r--r--tests/benchmark-crypto-hash.c4
-rw-r--r--tests/benchmark-crypto-hmac.c7
3 files changed, 14 insertions, 9 deletions
diff --git a/tests/benchmark-crypto-cipher.c b/tests/benchmark-crypto-cipher.c
index 1936aa4..c04f0a0 100644
--- a/tests/benchmark-crypto-cipher.c
+++ b/tests/benchmark-crypto-cipher.c
@@ -70,8 +70,10 @@ static void test_cipher_speed(size_t chunk_size,
}
g_test_timer_elapsed();
- g_test_message("Enc chunk %zu bytes ", chunk_size);
- g_test_message("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
+ g_test_message("enc(%s-%s) chunk %zu bytes %.2f MB/sec ",
+ QCryptoCipherAlgorithm_str(alg),
+ QCryptoCipherMode_str(mode),
+ chunk_size, (double)total / MiB / g_test_timer_last());
g_test_timer_start();
remain = total;
@@ -85,8 +87,10 @@ static void test_cipher_speed(size_t chunk_size,
}
g_test_timer_elapsed();
- g_test_message("Dec chunk %zu bytes ", chunk_size);
- g_test_message("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
+ g_test_message("dec(%s-%s) chunk %zu bytes %.2f MB/sec ",
+ QCryptoCipherAlgorithm_str(alg),
+ QCryptoCipherMode_str(mode),
+ chunk_size, (double)total / MiB / g_test_timer_last());
qcrypto_cipher_free(cipher);
g_free(plaintext);
diff --git a/tests/benchmark-crypto-hash.c b/tests/benchmark-crypto-hash.c
index 598111e..927b00b 100644
--- a/tests/benchmark-crypto-hash.c
+++ b/tests/benchmark-crypto-hash.c
@@ -48,7 +48,9 @@ static void test_hash_speed(const void *opaque)
}
g_test_timer_elapsed();
- g_test_message("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
+ g_test_message("hash(%s): chunk %zu bytes %.2f MB/sec",
+ QCryptoHashAlgorithm_str(opts->alg),
+ opts->chunk_size, total / g_test_timer_last());
g_free(out);
g_free(in);
diff --git a/tests/benchmark-crypto-hmac.c b/tests/benchmark-crypto-hmac.c
index f9fa22d..5cca636 100644
--- a/tests/benchmark-crypto-hmac.c
+++ b/tests/benchmark-crypto-hmac.c
@@ -55,10 +55,9 @@ static void test_hmac_speed(const void *opaque)
} while (g_test_timer_elapsed() < 5.0);
total /= MiB;
- g_test_message("hmac(sha256): ");
- g_test_message("Testing chunk_size %zu bytes ", chunk_size);
- g_test_message("done: %.2f MB in %.2f secs: ", total, g_test_timer_last());
- g_test_message("%.2f MB/sec\n", total / g_test_timer_last());
+ g_test_message("hmac(%s): chunk %zu bytes %.2f MB/sec",
+ QCryptoHashAlgorithm_str(QCRYPTO_HASH_ALG_SHA256),
+ chunk_size, total / g_test_timer_last());
g_free(out);
g_free(in);