From nobody Mon Feb 9 11:08:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529933358617177.80629940391373; Mon, 25 Jun 2018 06:29:18 -0700 (PDT) Received: from localhost ([::1]:46968 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXRYJ-0004Sb-GH for importer@patchew.org; Mon, 25 Jun 2018 09:29:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55278) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXQrx-0002sh-8O for qemu-devel@nongnu.org; Mon, 25 Jun 2018 08:45:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fXQru-0008Pn-I5 for qemu-devel@nongnu.org; Mon, 25 Jun 2018 08:45:21 -0400 Received: from mail-qk0-x229.google.com ([2607:f8b0:400d:c09::229]:40523) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fXQru-0008PS-2i; Mon, 25 Jun 2018 08:45:18 -0400 Received: by mail-qk0-x229.google.com with SMTP id b129-v6so7361430qke.7; Mon, 25 Jun 2018 05:45:17 -0700 (PDT) Received: from x1.local ([138.117.48.222]) by smtp.gmail.com with ESMTPSA id m15-v6sm12549562qtm.84.2018.06.25.05.45.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jun 2018 05:45:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BCxunVxWmwIk0FC6wcum33vfzo3NHW+vyJKJixCB1Ls=; b=NNuZvtdkhsmwhoBikzH4F7yv3Zo9U0f6vazwKZvnr0GndKID0GLHJrCvH+eT2SjcLe xontHW5Y8aHjx/oTNOVzt8AH7I7+f/cJabFHJZyeUQ1aEeRdC2Du3cMetBFGrcmtv7GB BIACBxAefQv43Q0ODgDNiPtX/ZgaooknfllZyRimaLpbdNIWeS2huD5mIKT2SMTUyAyN WU3ns8gGZSd7qE76IegWrpGY0SEg2vz882OzLP42YQt7yicuckWCJYWxBtosOkEZxDhd rNgyS1B4v/8f4xTvD0RpRVSdJkX1E1574emSalum3IX0G1dhjd4VtEVPKYFsnpi1CSDP sfTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=BCxunVxWmwIk0FC6wcum33vfzo3NHW+vyJKJixCB1Ls=; b=IRzfNu16w3CC0nm97k23acPKXRNppTP+eTtiwLYNhVdIwhSrRTL0GhFT8lu1vcYlWx P0QwFNgXs3Tl/UaFkLsgtl3+LmYKvJldWSYZsUmlUbnZrHicg7JgHBOaE6HU+3DP6tI7 DXmdi3ZhuRL+SIIju87V8014wKilfWK+eBBS8Qe/p3i6uNoEQ0UFwkt9oOK/tIhBYMPU dsT9cKhqZOvUR7+c+QG9Czdgwj6tvTUFJl6109NjhnOUEKjOHqs1KTCjxYURwQ/YpG46 M0DAQnHmqyqr7r0D7zMcXBZZvaxjDZJgBtvzJy4snjJzNJRYsd/k4ZdVgrdSoEnIwsyU NEdA== X-Gm-Message-State: APt69E2T2f8bGHvzOA9ylCgf4G3NTXRXC8QcqUgIRp9SoKgH68rPMO+N qszIaXxycAJWBf1KVx+ns8I= X-Google-Smtp-Source: ADUXVKL942NhWWbs802rgHh6Q1ZmM5dQlN719c6JgYvB2qjTsDHcqMhHLfbyV23WXr8WhQKQviDXXQ== X-Received: by 2002:a37:c20b:: with SMTP id i11-v6mr10613722qkm.316.1529930717531; Mon, 25 Jun 2018 05:45:17 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Thomas Huth , Stefan Weil , Eric Blake Date: Mon, 25 Jun 2018 09:42:36 -0300 Message-Id: <20180625124238.25339-45-f4bug@amsat.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180625124238.25339-1-f4bug@amsat.org> References: <20180625124238.25339-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::229 Subject: [Qemu-devel] [PATCH v5 44/46] tests/crypto: Use the IEC binary prefix definitions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 It eases code review, unit is explicit. Patch generated using: $ git grep -n '[<>][<>]=3D ?[1-5]0' and modified manually. Suggested-by: Eric Blake Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- tests/benchmark-crypto-cipher.c | 6 +++--- tests/benchmark-crypto-hash.c | 5 +++-- tests/benchmark-crypto-hmac.c | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/benchmark-crypto-cipher.c b/tests/benchmark-crypto-ciphe= r.c index cf98443468..f5a0d0bc32 100644 --- a/tests/benchmark-crypto-cipher.c +++ b/tests/benchmark-crypto-cipher.c @@ -11,6 +11,7 @@ * top-level directory. */ #include "qemu/osdep.h" +#include "qemu/units.h" #include "crypto/init.h" #include "crypto/cipher.h" =20 @@ -56,8 +57,7 @@ static void test_cipher_speed(const void *opaque) total +=3D chunk_size; } while (g_test_timer_elapsed() < 5.0); =20 - total /=3D 1024 * 1024; /* to MB */ - + total /=3D MiB; g_print("cbc(aes128): "); g_print("Testing chunk_size %zu bytes ", chunk_size); g_print("done: %.2f MB in %.2f secs: ", total, g_test_timer_last()); @@ -78,7 +78,7 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); g_assert(qcrypto_init(NULL) =3D=3D 0); =20 - for (i =3D 512; i <=3D (64 * 1204); i *=3D 2) { + for (i =3D 512; i <=3D 64 * KiB; i *=3D 2) { memset(name, 0 , sizeof(name)); snprintf(name, sizeof(name), "/crypto/cipher/speed-%zu", i); g_test_add_data_func(name, (void *)i, test_cipher_speed); diff --git a/tests/benchmark-crypto-hash.c b/tests/benchmark-crypto-hash.c index 122bfb6b85..9b6f7a9155 100644 --- a/tests/benchmark-crypto-hash.c +++ b/tests/benchmark-crypto-hash.c @@ -11,6 +11,7 @@ * top-level directory. */ #include "qemu/osdep.h" +#include "qemu/units.h" #include "crypto/init.h" #include "crypto/hash.h" =20 @@ -39,7 +40,7 @@ static void test_hash_speed(const void *opaque) total +=3D chunk_size; } while (g_test_timer_elapsed() < 5.0); =20 - total /=3D 1024 * 1024; /* to MB */ + total /=3D MiB; g_print("sha256: "); g_print("Testing chunk_size %zu bytes ", chunk_size); g_print("done: %.2f MB in %.2f secs: ", total, g_test_timer_last()); @@ -57,7 +58,7 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); g_assert(qcrypto_init(NULL) =3D=3D 0); =20 - for (i =3D 512; i <=3D (64 * 1204); i *=3D 2) { + for (i =3D 512; i <=3D 64 * KiB; i *=3D 2) { memset(name, 0 , sizeof(name)); snprintf(name, sizeof(name), "/crypto/hash/speed-%zu", i); g_test_add_data_func(name, (void *)i, test_hash_speed); diff --git a/tests/benchmark-crypto-hmac.c b/tests/benchmark-crypto-hmac.c index c30250df3e..f1dfa240cb 100644 --- a/tests/benchmark-crypto-hmac.c +++ b/tests/benchmark-crypto-hmac.c @@ -11,6 +11,7 @@ * top-level directory. */ #include "qemu/osdep.h" +#include "qemu/units.h" #include "crypto/init.h" #include "crypto/hmac.h" =20 @@ -53,8 +54,7 @@ static void test_hmac_speed(const void *opaque) total +=3D chunk_size; } while (g_test_timer_elapsed() < 5.0); =20 - total /=3D 1024 * 1024; /* to MB */ - + total /=3D MiB; g_print("hmac(sha256): "); g_print("Testing chunk_size %zu bytes ", chunk_size); g_print("done: %.2f MB in %.2f secs: ", total, g_test_timer_last()); @@ -72,7 +72,7 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); g_assert(qcrypto_init(NULL) =3D=3D 0); =20 - for (i =3D 512; i <=3D (64 * 1204); i *=3D 2) { + for (i =3D 512; i <=3D 64 * KiB; i *=3D 2) { memset(name, 0 , sizeof(name)); snprintf(name, sizeof(name), "/crypto/hmac/speed-%zu", i); g_test_add_data_func(name, (void *)i, test_hmac_speed); --=20 2.18.0