From patchwork Sat Feb 17 00:39:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 773698 Delivered-To: patch@linaro.org Received: by 2002:a5d:4943:0:b0:33b:4db1:f5b3 with SMTP id r3csp206570wrs; Fri, 16 Feb 2024 16:40:33 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWnoyqLQdzrfskvU1CPh4vY1sTApUsNXWeJuvBQDIZnhLMSrVEb+3p/b7xBuLUdhDrVSo/wnvM0az4LN6RFaNGl X-Google-Smtp-Source: AGHT+IFKld8j7Hd2ecjYzjfpX/1Lm5SWNQTD9xiIZf3VABDisoJcvlrKrTrAMz+csdfZsHWUEXxP X-Received: by 2002:a0c:f3d0:0:b0:68f:325f:d88c with SMTP id f16-20020a0cf3d0000000b0068f325fd88cmr3281826qvm.1.1708130432951; Fri, 16 Feb 2024 16:40:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708130432; cv=none; d=google.com; s=arc-20160816; b=Fhr4TxSiKZRPD7kuoMW7bfTgwEacqb8vFBSeDThYHVjEYiG5Vmzmq2+xYSatGuq+LZ 2IBHm2C3+vhia2NMbRSyt1xx3M8nGtZ/cXzsRGmuGKE67Hyj52pfeJfPx36WKhfPYRAt A7cAc+Wf2DqOmLFj7gBTR0CXDfOqxZBf1ogM3J5AxFXLkL6++yyE8gAxLA3jDHp+CnJl lIf7W48AnDYfHQmCebET/+98WlwoTmLa3rp3GQql1WWVzbD5OKAfdYHvm9wEiTRaVof2 ftCgNn9+Eg70KxnirzSXot9gMi/ejfUrSQxPaotxIOZVjlxtopNBr2JC3X8Rs94P3bME WZKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=q7NI6Uyf4Ttcuc/zyuTSXU3zmAAyzJ/7snw/vL2uCLQ=; fh=bXD9UGo7d05OYjVg0qF2wA28p2gxs496M6ftxgeDKVY=; b=HMKU5mpGURNgREflWMs7mrfBfagI29tWGSQI68MlcmmHRwCLupBJMQW7sVdWRnmMqI DFe+TN4TfF07xR1YbkpwN4NlQMCbojZIzNnagvuPMMzRwEMyi3HxoMFyXjUayKhDUdrp LactegK9w32Tj+jFMcfg3mn87NTGQrQSplzEeryOsiuKLemfX+fJolqxl0bI+IKmvDaU /RPIpuYHBqaqSAFpoMAGayCo+JjHuVV8qZwEIDAd0/7VYZvpEYw9oG1D20/K6AgjlRQE irqj1zupUVowqfXyp9N0DpiCcPMVXBJ40BokfQ/BMpT2ipqsQ5lg5hYsMZclG7eWjMoQ X2ZA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A+7ECMEH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id gm8-20020a056214268800b0068efb6d010dsi965073qvb.129.2024.02.16.16.40.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Feb 2024 16:40:32 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A+7ECMEH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rb8jz-00069T-VA; Fri, 16 Feb 2024 19:39:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rb8jy-00069I-7Z for qemu-devel@nongnu.org; Fri, 16 Feb 2024 19:39:38 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rb8jv-0008Hr-S5 for qemu-devel@nongnu.org; Fri, 16 Feb 2024 19:39:37 -0500 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1d934c8f8f7so27591955ad.2 for ; Fri, 16 Feb 2024 16:39:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708130374; x=1708735174; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=q7NI6Uyf4Ttcuc/zyuTSXU3zmAAyzJ/7snw/vL2uCLQ=; b=A+7ECMEHbBYmVaybAF8cM0cQgyB2QbbPGAmdw42c1eTrDWJgwnCWPUmiClNEG8MF4n LM5LJzKfRWTOcYX4M6zFPSI53BDOfy2a5CnS+wVJMcCkSXAFxNnMnBtMGlM5c0JpOZga c/lPjXDvJFL5Zpg2XheUVB9zVwF8Vyg1ftZ1Sms4vsY2Vti4QWo+7QL/RMt5jF+Wqww0 UhYwUwXfPo4qRyVoqD5Yenm9PhMlfuQoLa4FHn/eB3L9nK9ht7Cx/MJQUb9eC8Rmcmii Tka6xBilw+v9KNxiVbUjc7wSVA92oxPs4eC49FQPQLpES38G6V6g3i7hC/goIOWzp40L lE7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708130374; x=1708735174; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q7NI6Uyf4Ttcuc/zyuTSXU3zmAAyzJ/7snw/vL2uCLQ=; b=BVVwxw9mviGPhGHdkKeSr6ukvvFI3wibSxf69z1TblsfC1PBQJMkRal5spGo2X/wsQ t3+uFbEit1Nomgy9+1zTTC+iZ7QzuqbKxSx/fWle/vjjrB2u0bZ5rJ91OCXJ7OGxby22 +F6qZB9z8AfrdOn/4VU2dMPd+SXYIwXry0s6Q4yzDjwL7m+htOWCKs42pnXktKuuDElL BzG4DnOsHnULTz6PcBg91CYFq2WZZxclCA9rybwGu+Ro0k/9Fw2an+pBgduyClyAHQ25 WRBgk28EajfCujj3VrNlmeQ/mhs+Vj4eoGmwu8TBEzMF1DflVpjMiL6scYq6ppcaxqR1 eYcw== X-Gm-Message-State: AOJu0Yw9fb8RpbUPlNruKyNP5jwehq08QgdkM87coK1AsBNCf9D8YZZ/ pi7f+XDOd7eVnt5oVhLj/h+MiLevL9lY/8l0mYtJgd1WXwrUgQ+r0/hEGq6CkxefDa0hQpXUU4z K X-Received: by 2002:a17:902:ce92:b0:1d7:147d:6a1d with SMTP id f18-20020a170902ce9200b001d7147d6a1dmr7161232plg.55.1708130374676; Fri, 16 Feb 2024 16:39:34 -0800 (PST) Received: from stoup.. (173-197-098-125.biz.spectrum.com. [173.197.98.125]) by smtp.gmail.com with ESMTPSA id z6-20020a170902ee0600b001d90306bdcfsm419325plb.65.2024.02.16.16.39.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 16:39:34 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: amonakov@ispras.ru, mmromanov@ispras.ru Subject: [PATCH v5 10/10] tests/bench: Add bufferiszero-bench Date: Fri, 16 Feb 2024 14:39:18 -1000 Message-Id: <20240217003918.52229-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240217003918.52229-1-richard.henderson@linaro.org> References: <20240217003918.52229-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Benchmark each acceleration function vs an aligned buffer of zeros. Signed-off-by: Richard Henderson --- tests/bench/bufferiszero-bench.c | 42 ++++++++++++++++++++++++++++++++ tests/bench/meson.build | 4 ++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 tests/bench/bufferiszero-bench.c diff --git a/tests/bench/bufferiszero-bench.c b/tests/bench/bufferiszero-bench.c new file mode 100644 index 0000000000..1fa2eb6973 --- /dev/null +++ b/tests/bench/bufferiszero-bench.c @@ -0,0 +1,42 @@ +/* + * QEMU buffer_is_zero speed benchmark + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * (at your option) any later version. See the COPYING file in the + * top-level directory. + */ +#include "qemu/osdep.h" +#include "qemu/cutils.h" +#include "qemu/units.h" + +static void test(const void *opaque) +{ + size_t len = 64 * KiB; + void *buf = g_malloc0(len); + int accel_index = 0; + + do { + double total = 0.0; + + g_test_timer_start(); + do { + buffer_is_zero_ge256(buf, len); + total += len; + } while (g_test_timer_elapsed() < 5.0); + + total /= MiB; + g_test_message("buffer_is_zero #%d: %.2f MB/sec", + accel_index, total / g_test_timer_last()); + + accel_index++; + } while (test_buffer_is_zero_next_accel()); + + g_free(buf); +} + +int main(int argc, char **argv) +{ + g_test_init(&argc, &argv, NULL); + g_test_add_data_func("/cutils/bufferiszero/speed", NULL, test); + return g_test_run(); +} diff --git a/tests/bench/meson.build b/tests/bench/meson.build index 7e76338a52..70d45ff400 100644 --- a/tests/bench/meson.build +++ b/tests/bench/meson.build @@ -17,7 +17,9 @@ executable('atomic64-bench', dependencies: [qemuutil], build_by_default: false) -benchs = {} +benchs = { + 'bufferiszero-bench': [], +} if have_block benchs += {