qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

tests/crypto: Use the IEC binary prefix definitions

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>

authored by

Philippe Mathieu-Daudé and committed by
Paolo Bonzini
68dbb6d0 3dc54b0e

+9 -8
+3 -3
tests/benchmark-crypto-cipher.c
··· 11 11 * top-level directory. 12 12 */ 13 13 #include "qemu/osdep.h" 14 + #include "qemu/units.h" 14 15 #include "crypto/init.h" 15 16 #include "crypto/cipher.h" 16 17 ··· 56 57 total += chunk_size; 57 58 } while (g_test_timer_elapsed() < 5.0); 58 59 59 - total /= 1024 * 1024; /* to MB */ 60 - 60 + total /= MiB; 61 61 g_print("cbc(aes128): "); 62 62 g_print("Testing chunk_size %zu bytes ", chunk_size); 63 63 g_print("done: %.2f MB in %.2f secs: ", total, g_test_timer_last()); ··· 78 78 g_test_init(&argc, &argv, NULL); 79 79 g_assert(qcrypto_init(NULL) == 0); 80 80 81 - for (i = 512; i <= (64 * 1204); i *= 2) { 81 + for (i = 512; i <= 64 * KiB; i *= 2) { 82 82 memset(name, 0 , sizeof(name)); 83 83 snprintf(name, sizeof(name), "/crypto/cipher/speed-%zu", i); 84 84 g_test_add_data_func(name, (void *)i, test_cipher_speed);
+3 -2
tests/benchmark-crypto-hash.c
··· 11 11 * top-level directory. 12 12 */ 13 13 #include "qemu/osdep.h" 14 + #include "qemu/units.h" 14 15 #include "crypto/init.h" 15 16 #include "crypto/hash.h" 16 17 ··· 39 40 total += chunk_size; 40 41 } while (g_test_timer_elapsed() < 5.0); 41 42 42 - total /= 1024 * 1024; /* to MB */ 43 + total /= MiB; 43 44 g_print("sha256: "); 44 45 g_print("Testing chunk_size %zu bytes ", chunk_size); 45 46 g_print("done: %.2f MB in %.2f secs: ", total, g_test_timer_last()); ··· 57 58 g_test_init(&argc, &argv, NULL); 58 59 g_assert(qcrypto_init(NULL) == 0); 59 60 60 - for (i = 512; i <= (64 * 1204); i *= 2) { 61 + for (i = 512; i <= 64 * KiB; i *= 2) { 61 62 memset(name, 0 , sizeof(name)); 62 63 snprintf(name, sizeof(name), "/crypto/hash/speed-%zu", i); 63 64 g_test_add_data_func(name, (void *)i, test_hash_speed);
+3 -3
tests/benchmark-crypto-hmac.c
··· 11 11 * top-level directory. 12 12 */ 13 13 #include "qemu/osdep.h" 14 + #include "qemu/units.h" 14 15 #include "crypto/init.h" 15 16 #include "crypto/hmac.h" 16 17 ··· 53 54 total += chunk_size; 54 55 } while (g_test_timer_elapsed() < 5.0); 55 56 56 - total /= 1024 * 1024; /* to MB */ 57 - 57 + total /= MiB; 58 58 g_print("hmac(sha256): "); 59 59 g_print("Testing chunk_size %zu bytes ", chunk_size); 60 60 g_print("done: %.2f MB in %.2f secs: ", total, g_test_timer_last()); ··· 72 72 g_test_init(&argc, &argv, NULL); 73 73 g_assert(qcrypto_init(NULL) == 0); 74 74 75 - for (i = 512; i <= (64 * 1204); i *= 2) { 75 + for (i = 512; i <= 64 * KiB; i *= 2) { 76 76 memset(name, 0 , sizeof(name)); 77 77 snprintf(name, sizeof(name), "/crypto/hmac/speed-%zu", i); 78 78 g_test_add_data_func(name, (void *)i, test_hmac_speed);