From patchwork Sat Jun 30 06:10:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 937314 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="AAjdtm13"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41HkDf5Ln5z9s1B for ; Sat, 30 Jun 2018 16:31:14 +1000 (AEST) Received: from localhost ([::1]:45771 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fZ9Pc-0005OQ-Cm for incoming@patchwork.ozlabs.org; Sat, 30 Jun 2018 02:31:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fZ96a-0004hF-Oj for qemu-devel@nongnu.org; Sat, 30 Jun 2018 02:11:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fZ96W-00037P-QX for qemu-devel@nongnu.org; Sat, 30 Jun 2018 02:11:32 -0400 Received: from mail-wr0-x229.google.com ([2a00:1450:400c:c0c::229]:33913) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fZ96W-00034t-Iz for qemu-devel@nongnu.org; Sat, 30 Jun 2018 02:11:28 -0400 Received: by mail-wr0-x229.google.com with SMTP id a12-v6so10656909wro.1 for ; Fri, 29 Jun 2018 23:11:28 -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=aZEyCt1pqPdRmhk6V6gujUUSM3PRVc1sd5lh+bN2xwA=; b=AAjdtm13LtCYtzLga1wO04/l4vAWrPBPuIvgGqQsNlS4PaGDc+/OYYB89dUp243DSH lfUoaiq/2WZ3xUc8onbZf1VvlYkWbu8DyB5AVRRYaS2liQkFBQvU1j4ytHiwWmUkyO8z Zi6RGG2Jx/JRd/fUvgaaVdV9qkxxw0Ic8iEkrbsshyFhtyEzjP4G3Pmd2S5tTFLz2TdM ljyHxfvOEaG6Lq/2bzqrtq/5f5ycou8mkbWVcyR14qOeyK07bzoknCFxY6uuBEBaGNML AY2o6kQ4NH6JeuK9Vbt0hfIxXI0lZqlZHtsWzpUy0Wz/fH+x8JW0U7LqQu5p9zSZrPxD SZYQ== 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=aZEyCt1pqPdRmhk6V6gujUUSM3PRVc1sd5lh+bN2xwA=; b=PUNEhpXcWaIVLJDCrm1ATLLFwtFAKnz75Tut/nvm4XqjP7sSMeXRB6Zrq0OLG332xK jlPjxs6dXG+RhbjVrxrHK5KsAeHwFcnTIQOPgUicDTNauYIkvxwht8CqwuESh8gSioC+ vwb/Z+cmHzLfXQrLx5bYiDJ54gne3CFRmsS+5B0MEJgSUAD9igvqNOiuphHTVYDbNxKx A9aC8gkbPpTiwL/QggBPO2xZA2jQD5vGJKdKEMQqFEDut6jkyRMomFvghAIYkym8TfHW Y20x8R6yCm5zJbB+BVFxwXkMdDJZ58sLiHL2t+G1StlxzEPQyiYMRIbRpG7LrvS8fVYl CaFg== X-Gm-Message-State: APt69E1v+zEo76CD3Ji9imbodbs14q74Wd7p48XWJO98zh9PWjUtLWVE ii5NRxlU0lY9tah8w29KhZLAzRvM X-Google-Smtp-Source: AAOMgpfqpqZMonvXJuvwFKMou/Mu6jPZm++xPI6EZ9mUpkrFQcsTK9aweFPh0RJuiisNeV7CSL9Hmg== X-Received: by 2002:adf:acc3:: with SMTP id o61-v6mr14781367wrc.34.1530339087373; Fri, 29 Jun 2018 23:11:27 -0700 (PDT) Received: from donizetti.lan ([82.84.124.111]) by smtp.gmail.com with ESMTPSA id 24-v6sm563454wrz.94.2018.06.29.23.11.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Jun 2018 23:11:26 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Sat, 30 Jun 2018 08:10:37 +0200 Message-Id: <20180630061040.6018-45-pbonzini@redhat.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180630061040.6018-1-pbonzini@redhat.com> References: <20180630061040.6018-1-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::229 Subject: [Qemu-devel] [PULL 44/47] 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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Philippe 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 Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20180625124238.25339-45-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- 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-cipher.c index cf98443..f5a0d0b 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" @@ -56,8 +57,7 @@ static void test_cipher_speed(const void *opaque) total += chunk_size; } while (g_test_timer_elapsed() < 5.0); - total /= 1024 * 1024; /* to MB */ - + total /= 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) == 0); - for (i = 512; i <= (64 * 1204); i *= 2) { + for (i = 512; i <= 64 * KiB; i *= 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 122bfb6..9b6f7a9 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" @@ -39,7 +40,7 @@ static void test_hash_speed(const void *opaque) total += chunk_size; } while (g_test_timer_elapsed() < 5.0); - total /= 1024 * 1024; /* to MB */ + total /= 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) == 0); - for (i = 512; i <= (64 * 1204); i *= 2) { + for (i = 512; i <= 64 * KiB; i *= 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 c30250d..f1dfa24 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" @@ -53,8 +54,7 @@ static void test_hmac_speed(const void *opaque) total += chunk_size; } while (g_test_timer_elapsed() < 5.0); - total /= 1024 * 1024; /* to MB */ - + total /= 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) == 0); - for (i = 512; i <= (64 * 1204); i *= 2) { + for (i = 512; i <= 64 * KiB; i *= 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);