From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id D89C6388456D for ; Wed, 19 Jun 2024 14:17:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D89C6388456D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D89C6388456D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718806634; cv=none; b=urZlXWzPZPp01ncTICuYxswKNuwJM0WAWx+WBulDvE5afePo+ZoJq3Ylh96XKBhDav0dK+Vfv8c9GSe2QnYZT566PW6kVYzhFgzlRrzMn7IA8SvSwBL/7vp7Bjy/6x+nplCj/vheQctTb1H5KIH1WwnXa5QIAKm7WKDlq2If3tU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718806634; c=relaxed/simple; bh=CANpVbWvXXVrXbonJ0RZ1PHMseawoLma39nsUc84Slk=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=noHyiAE77Cgk+8OTAEmpJz/V+CCljo+JdZEnivQy4E3s3iT+x8Dvdth7SfHOVkwmRaahNff88CkzVY3mbRUbEeetaumPOTpHm8JNhpiUZAC/FEU2J6uURn3JQO/WvUo15KpkMpxNPBiqvYa3k+JZa6fpyVHx84vcBM++LI74eLQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718806630; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=Au5JpFMcDEA3Pr1fLHwBLj8Yf3r9ookSIPJprQOuBII=; b=ZhQkz1hFdvxxEacc2OUOr1+ysEbL9aNuDYsJn1dG6+v1aRAL2LG+3DkjGXBMjD/w6CcS/L 7g+kf1417Ol3KdowIXTC02w6qVJU8huoouBTtvQ8LfNJA+T43av9Kh1qRUS4jOcXqY/16Q Cs0VS4V8bsStIV1zQv2XnqOGg3SaLEs= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-456-OCbwE1rSPo6-N2FhMIuKFw-1; Wed, 19 Jun 2024 10:17:08 -0400 X-MC-Unique: OCbwE1rSPo6-N2FhMIuKFw-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-797f78dc5aaso942114885a.0 for ; Wed, 19 Jun 2024 07:17:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718806628; x=1719411428; h=content-transfer-encoding:in-reply-to:organization:autocrypt:from :content-language:references:to:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Au5JpFMcDEA3Pr1fLHwBLj8Yf3r9ookSIPJprQOuBII=; b=p2qljV5JO1eayzhqNBcON5RvK+h+bD2FbA4RO/9mxV6A7Dh+QSPHB6KuveDLvUS/Em PHlgMad96BmbnJejZoQQW7/TKPEXw6PKd2rFARjSeoDPCW+kIloNUD6lc5lT/s7MMBz3 BrlPxSdmLQpa/Ve0YlnDbAKRnZj/xwfSq9Fdr2YMuZTz+8r2bBZxlO3jUTd/dB2HUApi mP5NxvdNoCdVx426hDe3ltvKZag9GsTygSojm7XrNNVBpZdkZwuwZJXdya+Q4pkuVkAz RI1y0CfmDnQWBM45x01SpeqNkBOpB6ok4bCu9fnkzqRH+36+X61I4WRfzbRXBCV3zuGz XM+g== X-Forwarded-Encrypted: i=1; AJvYcCWd73WUzdZ1mcocjfx5FRolwgxQWmXkDo+rsJ9pb/cpjkwBaPpYyHn616aSdFQG/9lGjcrbiqQKhHNckgfEoIeOeTtdybfdZn2S X-Gm-Message-State: AOJu0YzSz0J7sFTWjOwu3D4NIO+Q78sq2clSjgMh6vCI8kCpyjGuGAHL Xe1redBiY+F51MY8gIkigouqe1hUJK99DPqIhZoFNIa2GzzdeyDgA3dbASdV3zX/7MRYkf6cIYj 6pxRmrMqg/pUlbRJpw2NqBRbvkLUNh722OMA0uzRS9ovLOXMckdhtERF3OQ== X-Received: by 2002:a05:620a:4706:b0:795:5df4:d787 with SMTP id af79cd13be357-79bb3eedc6fmr273009785a.70.1718806628273; Wed, 19 Jun 2024 07:17:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHiD6ePWJxmCAPx0+7JuBXWw2L0CmsMf0Zk/Lqi+KohZhyJ35nGalpZR1SKmgHkfia+EIgGwQ== X-Received: by 2002:a05:620a:4706:b0:795:5df4:d787 with SMTP id af79cd13be357-79bb3eedc6fmr273005985a.70.1718806627657; Wed, 19 Jun 2024 07:17:07 -0700 (PDT) Received: from [192.168.0.241] ([198.48.244.52]) by smtp.gmail.com with ESMTPSA id af79cd13be357-798d9dd524bsm520885885a.66.2024.06.19.07.17.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Jun 2024 07:17:07 -0700 (PDT) Message-ID: <1cb20dd3-7fd7-45f7-b9eb-c07f79c6b376@redhat.com> Date: Wed, 19 Jun 2024 10:17:06 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Benchtests: Remove broken walk benchmarks To: Wilco Dijkstra , 'GNU C Library' References: From: Carlos O'Donell Autocrypt: addr=carlos@redhat.com; keydata= xsFNBFef5BoBEACvJ15QMMZh4stKHbz0rs78XsOdxuug37dumTx6ngrDCwZ61k7nHQ+uxLuo QvLSc6YJGBEfiNFbs1hvhRFNR7x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k9M0GvTvPKoah9gkvL/+AofN/31ABEBAAHCwXwEGAEIACYCGwwWIQRyc1QrOZYt97KZkxQW eStOolNA+AUCZK2RDAUJDwAD8gAKCRAWeStOolNA+B0MEACVxFO++NroEQxSQ0NCWod3aDmY mYn+/08wLTeMP+ajq19FEjU0Lh/GBJl6WlSHeJ5ZJlNSiXZuiSYGMYm73DBaoZlyjbD+H9NL LwLXgtfCZYlN6Iu8JRMfk9yevVBay7Be9DkPAk565ggo0UkIjpYftiLF4TUfqnI1yO6QKXgr J2DDwlP3iiCYnWFpHdBTB2/BRurpZoRquhRGzgcdGfRDtp16Pzm/u8BjfaU5/AFRjM0IDYQ6 PaQld0uZSZ0qOn0ts6usJws5gANq4U1oWJlqL/PHOFy9mbwUnKqq0oiWrmj+Mb+Ic6m9fqB3 5CHWUhxC1QozvkuY/sTsmXnG/mnbq2oFIVcgXDsnrDHf+0GyR+TrE4AQw1Pt2utsmU67LqNB Ru/2NbSFgwPv5wWjtNwDVGSZEXlV4qJGjh8S9aaGXhRTwJsnN6qkFS1m6vHKwqnRb5Qy4XDg 7kDrhFnTWe+XSwQt+HtGvIiXcR3EScJky76YlVsWDtvZMo3NePaC3qV5HAC8d2ZL3sFqxJRu sRyjE2l6s0EEK2MUgV/dwodftECrMdGktndVTYPqLnsua/PWWKYwYrNvD8slL6VFkXDZvLLv nat9vl9mBm15b76RHvKNlRcPbB9YYCbS5fhN2ObAsVbV1c5TdBCp8lp1Fa3YK0TA+WpNZVHK vjq6hMJAjA== Organization: Red Hat In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_LOTSOFHASH,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 3/23/23 7:55 AM, Wilco Dijkstra via Libc-alpha wrote: > > The walk benchmarks don't measure anything useful - memory is not initialized > properly so doing a single walk in 32MB just measures reading the 4KB zero > page for reads and clear_page overhead for writes. The memset variants don't > even manage to do a walk in the 32MB region due to using incorrect pointer > increments... Neither is it clear why it is walking backwards since this > won't confuse modern prefetchers. If you fix the benchmark and print the > bandwidth, the results are identical for all sizes larger than ~1KB since it > is just testing memory bandwidth of a single 32MB block. This case is already > tested by the large benchmark, so overall it doesn't seem useful to keep these. Agreed! Please remove them. Reviewed-by: Carlos O'Donell > --- > > diff --git a/benchtests/Makefile b/benchtests/Makefile > index 721f32afdbc93da42b4f4ce6ba09e92c18613607..0c2b396d6935ecb3fbd5620c076a8ba33e7f3f7a 100644 > --- a/benchtests/Makefile > +++ b/benchtests/Makefile > @@ -125,7 +125,6 @@ bench-string := \ > string-benchset := \ > bzero \ > bzero-large \ > - bzero-walk \ > memccpy \ > memchr \ > memcmp \ > @@ -133,19 +132,15 @@ string-benchset := \ > memcpy \ > memcpy-large \ > memcpy-random \ > - memcpy-walk \ > memmem \ > memmove \ > memmove-large \ > - memmove-walk \ > mempcpy \ > memrchr \ > memset \ > memset-large \ > - memset-walk \ > memset-zero \ > memset-zero-large \ > - memset-zero-walk \ > rawmemchr \ > stpcpy \ > stpcpy_chk \ > diff --git a/benchtests/bench-bzero-walk.c b/benchtests/bench-bzero-walk.c > deleted file mode 100644 > index 77bdabeb0d44d7150a78bd345c97edf88b133735..0000000000000000000000000000000000000000 > --- a/benchtests/bench-bzero-walk.c > +++ /dev/null > @@ -1,143 +0,0 @@ > -/* Measure memset function throughput with large data sizes. > - Copyright (C) 2017-2023 Free Software Foundation, Inc. > - This file is part of the GNU C Library. > - > - The GNU C Library is free software; you can redistribute it and/or > - modify it under the terms of the GNU Lesser General Public > - License as published by the Free Software Foundation; either > - version 2.1 of the License, or (at your option) any later version. > - > - The GNU C Library is distributed in the hope that it will be useful, > - but WITHOUT ANY WARRANTY; without even the implied warranty of > - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > - Lesser General Public License for more details. > - > - You should have received a copy of the GNU Lesser General Public > - License along with the GNU C Library; if not, see > - . */ > - > -#define TEST_MAIN > -#ifdef DO_MEMSET > -# define TEST_NAME "memset" > -#else > -# define TEST_NAME "bzero" > -#endif > -#define START_SIZE 128 > -#define MIN_PAGE_SIZE (getpagesize () + 32 * 1024 * 1024) > -#define TIMEOUT (20 * 60) > -#include "bench-string.h" > - > -#include "json-lib.h" > - > -#ifdef DO_MEMSET > -void *generic_memset (void *, int, size_t); > - > -typedef void *(*proto_t) (void *, int, size_t); > - > -IMPL (memset, 1) > -IMPL (generic_memset, 0) > - > -#else > -static void > -memset_zero (void * s, size_t len) > -{ > - memset (s, '\0', len); > -} > - > -typedef void (*proto_t) (void *, size_t); > - > -IMPL (bzero, 1) > -IMPL (memset_zero, 0) > -#endif > - > -static void > -do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, CHAR *s_end, > - size_t n) > -{ > - size_t i, iters = MIN_PAGE_SIZE / n; > - timing_t start, stop, cur; > - > - TIMING_NOW (start); > - for (i = 0; i < iters && s <= s_end; s_end -= n, i++) > -#ifdef DO_MEMSET > - CALL (impl, s, 0, n); > -#else > - CALL (impl, s, n); > -#endif > - TIMING_NOW (stop); > - > - TIMING_DIFF (cur, start, stop); > - > - /* Get time taken per function call. */ > - json_element_double (json_ctx, (double) cur / i); > -} > - > -static void > -do_test (json_ctx_t *json_ctx, size_t len) > -{ > - json_element_object_begin (json_ctx); > - json_attr_uint (json_ctx, "length", len); > - json_array_begin (json_ctx, "timings"); > - > - FOR_EACH_IMPL (impl, 0) > - { > - do_one_test (json_ctx, impl, (CHAR *) buf1, > - (CHAR *) buf1 + MIN_PAGE_SIZE - len, len); > - alloc_bufs (); > - } > - > - json_array_end (json_ctx); > - json_element_object_end (json_ctx); > -} > - > -int > -test_main (void) > -{ > - json_ctx_t json_ctx; > - size_t i; > - > - test_init (); > - > - json_init (&json_ctx, 0, stdout); > - > - json_document_begin (&json_ctx); > - json_attr_string (&json_ctx, "timing_type", TIMING_TYPE); > - > - json_attr_object_begin (&json_ctx, "functions"); > - json_attr_object_begin (&json_ctx, TEST_NAME); > - json_attr_string (&json_ctx, "bench-variant", "walk"); > - > - json_array_begin (&json_ctx, "ifuncs"); > - FOR_EACH_IMPL (impl, 0) > - json_element_string (&json_ctx, impl->name); > - json_array_end (&json_ctx); > - > - json_array_begin (&json_ctx, "results"); > - for (i = 1; i <= 64; i++) > - do_test (&json_ctx, i); > - > - for (i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1) > - { > - do_test (&json_ctx, i); > - do_test (&json_ctx, i + 1); > - } > - > - json_array_end (&json_ctx); > - json_attr_object_end (&json_ctx); > - json_attr_object_end (&json_ctx); > - json_document_end (&json_ctx); > - > - return ret; > -} > - > -#include > - > -#ifdef DO_MEMSET > -# define libc_hidden_builtin_def(X) > -# define libc_hidden_def(X) > -# define libc_hidden_weak(X) > -# define weak_alias(X,Y) > -# undef MEMSET > -# define MEMSET generic_memset > -# include > -#endif > diff --git a/benchtests/bench-memcpy-walk.c b/benchtests/bench-memcpy-walk.c > deleted file mode 100644 > index 12de8a9e819e02d3c608532640e955688ac8415a..0000000000000000000000000000000000000000 > --- a/benchtests/bench-memcpy-walk.c > +++ /dev/null > @@ -1,131 +0,0 @@ > -/* Measure memcpy function combined throughput for different alignments. > - Copyright (C) 2017-2023 Free Software Foundation, Inc. > - This file is part of the GNU C Library. > - > - The GNU C Library is free software; you can redistribute it and/or > - modify it under the terms of the GNU Lesser General Public > - License as published by the Free Software Foundation; either > - version 2.1 of the License, or (at your option) any later version. > - > - The GNU C Library is distributed in the hope that it will be useful, > - but WITHOUT ANY WARRANTY; without even the implied warranty of > - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > - Lesser General Public License for more details. > - > - You should have received a copy of the GNU Lesser General Public > - License along with the GNU C Library; if not, see > - . */ > - > -/* This microbenchmark measures the throughput of memcpy for various sizes from > - 1 byte to 32MiB, doubling every iteration and then misaligning by 0-15 > - bytes. The copies are done from source to destination and then back and the > - source walks forward across the array and the destination walks backward by > - one byte each, thus measuring misaligned accesses as well. The idea is to > - avoid caching effects by copying a different string and far enough from each > - other, walking in different directions so that we can measure prefetcher > - efficiency (software or hardware) more closely than with a loop copying the > - same data over and over, which eventually only gives us L1 cache > - performance. */ > - > -#ifndef MEMCPY_RESULT > -# define MEMCPY_RESULT(dst, len) dst > -# define START_SIZE 128 > -# define MIN_PAGE_SIZE (getpagesize () + 32 * 1024 * 1024) > -# define TEST_MAIN > -# define TEST_NAME "memcpy" > -# define TIMEOUT (20 * 60) > -# include "bench-string.h" > - > -IMPL (memcpy, 1) > -#endif > - > -#include "json-lib.h" > - > -typedef char *(*proto_t) (char *, const char *, size_t); > - > -static void > -do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, char *src, > - size_t len) > -{ > - size_t i = 0; > - timing_t start, stop, cur; > - > - char *dst_end = dst + MIN_PAGE_SIZE - len; > - char *src_end = src + MIN_PAGE_SIZE - len; > - > - TIMING_NOW (start); > - /* Copy the entire buffer backwards, LEN at a time. */ > - for (; src_end >= src && dst_end >= dst; src_end -= len, dst_end -= len, i++) > - CALL (impl, src_end, dst_end, len); > - TIMING_NOW (stop); > - > - TIMING_DIFF (cur, start, stop); > - > - /* Get time taken per function call. */ > - json_element_double (json_ctx, (double) cur / i); > -} > - > -static void > -do_test (json_ctx_t *json_ctx, size_t len, int both_ways) > -{ > - > - char *s1, *s2; > - size_t repeats; > - s1 = (char *) (buf1); > - s2 = (char *) (buf2); > - > - for (repeats = both_ways ? 2 : 1; repeats; --repeats) > - { > - json_element_object_begin (json_ctx); > - json_attr_uint (json_ctx, "length", (double) len); > - json_attr_uint (json_ctx, "dst > src", (double) (s2 > s1)); > - json_array_begin (json_ctx, "timings"); > - > - FOR_EACH_IMPL (impl, 0) > - do_one_test (json_ctx, impl, s2, s1, len); > - > - json_array_end (json_ctx); > - json_element_object_end (json_ctx); > - > - s1 = (char *) (buf2); > - s2 = (char *) (buf1); > - } > -} > - > -int > -test_main (void) > -{ > - json_ctx_t json_ctx; > - > - test_init (); > - > - json_init (&json_ctx, 0, stdout); > - > - json_document_begin (&json_ctx); > - json_attr_string (&json_ctx, "timing_type", TIMING_TYPE); > - > - json_attr_object_begin (&json_ctx, "functions"); > - json_attr_object_begin (&json_ctx, "memcpy"); > - json_attr_string (&json_ctx, "bench-variant", "walk"); > - > - json_array_begin (&json_ctx, "ifuncs"); > - FOR_EACH_IMPL (impl, 0) > - json_element_string (&json_ctx, impl->name); > - json_array_end (&json_ctx); > - > - json_array_begin (&json_ctx, "results"); > - for (size_t i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1) > - { > - do_test (&json_ctx, i, 1); > - do_test (&json_ctx, i + 1, 1); > - } > - > - json_array_end (&json_ctx); > - json_attr_object_end (&json_ctx); > - json_attr_object_end (&json_ctx); > - json_document_end (&json_ctx); > - > - return ret; > -} > - > -#include > diff --git a/benchtests/bench-memmove-walk.c b/benchtests/bench-memmove-walk.c > deleted file mode 100644 > index c93ada461880f21b898ac244130a80ffe380a269..0000000000000000000000000000000000000000 > --- a/benchtests/bench-memmove-walk.c > +++ /dev/null > @@ -1,160 +0,0 @@ > -/* Measure memmove function combined throughput for different alignments. > - Copyright (C) 2017-2023 Free Software Foundation, Inc. > - This file is part of the GNU C Library. > - > - The GNU C Library is free software; you can redistribute it and/or > - modify it under the terms of the GNU Lesser General Public > - License as published by the Free Software Foundation; either > - version 2.1 of the License, or (at your option) any later version. > - > - The GNU C Library is distributed in the hope that it will be useful, > - but WITHOUT ANY WARRANTY; without even the implied warranty of > - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > - Lesser General Public License for more details. > - > - You should have received a copy of the GNU Lesser General Public > - License along with the GNU C Library; if not, see > - . */ > - > -/* This microbenchmark measures the throughput of memmove for various sizes from > - 1 byte to 32MiB, doubling every iteration and then misaligning by 0-15 > - bytes. The copies are done from source to destination and then back and the > - source walks forward across the array and the destination walks backward by > - one byte each, thus measuring misaligned accesses as well. The idea is to > - avoid caching effects by copying a different string and far enough from each > - other, walking in different directions so that we can measure prefetcher > - efficiency (software or hardware) more closely than with a loop copying the > - same data over and over, which eventually only gives us L1 cache > - performance. */ > - > -#ifndef MEMMOVE_RESULT > -# define MEMMOVE_RESULT(dst, len) dst > -# define START_SIZE 128 > -# define MIN_PAGE_SIZE (getpagesize () + 32 * 1024 * 1024) > -# define TEST_MAIN > -# define TEST_NAME "memmove" > -# define TIMEOUT (20 * 60) > -# include "bench-string.h" > - > -#define NO_OVERLAP 0 > -#define PARTIAL_OVERLAP 1 > -#define COMPLETE_OVERLAP 2 > - > -IMPL (memmove, 1) > -#endif > - > -#include "json-lib.h" > - > -typedef char *(*proto_t) (char *, const char *, size_t); > - > -static void > -do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, char *src, > - size_t len) > -{ > - size_t i = 0; > - timing_t start, stop, cur; > - > - char *dst_end = dst + MIN_PAGE_SIZE - len; > - char *src_end = src + MIN_PAGE_SIZE - len; > - > - TIMING_NOW (start); > - /* Copy the entire buffer backwards, LEN at a time. */ > - for (; src_end >= src && dst <= dst_end; dst += len, src_end -= len, i++) > - CALL (impl, dst, src_end, len); > - TIMING_NOW (stop); > - > - TIMING_DIFF (cur, start, stop); > - > - /* Get time taken per function call. */ > - json_element_double (json_ctx, (double) cur / i); > -} > - > -static void > -do_test (json_ctx_t *json_ctx, size_t len, int overlap, int both_ways) > -{ > - char *s1, *s2, *tmp; > - size_t repeats; > - > - s1 = (char *) (buf1); > - s2 = (char *) (buf2); > - if (overlap != NO_OVERLAP) > - s2 = s1; > - if (overlap == PARTIAL_OVERLAP) > - s2 += len / 2; > - > - for (repeats = both_ways ? 2 : 1; repeats; --repeats) > - { > - json_element_object_begin (json_ctx); > - json_attr_uint (json_ctx, "length", (double) len); > - json_attr_string(json_ctx, "overlap", > - overlap == NO_OVERLAP ? "none" > - : overlap == PARTIAL_OVERLAP ? "partial" > - : "complete"); > - json_attr_uint (json_ctx, "dst > src", (double) (s2 > s1)); > - json_array_begin (json_ctx, "timings"); > - > - > - FOR_EACH_IMPL (impl, 0) > - do_one_test (json_ctx, impl, (char *) buf2, (char *) buf1, len); > - > - json_array_end (json_ctx); > - json_element_object_end (json_ctx); > - > - tmp = s1; > - s1 = s2; > - s2 = tmp; > - } > -} > - > -int > -test_main (void) > -{ > - json_ctx_t json_ctx; > - > - test_init (); > - > - json_init (&json_ctx, 0, stdout); > - > - json_document_begin (&json_ctx); > - json_attr_string (&json_ctx, "timing_type", TIMING_TYPE); > - > - json_attr_object_begin (&json_ctx, "functions"); > - json_attr_object_begin (&json_ctx, "memmove"); > - json_attr_string (&json_ctx, "bench-variant", "walk"); > - > - json_array_begin (&json_ctx, "ifuncs"); > - FOR_EACH_IMPL (impl, 0) > - json_element_string (&json_ctx, impl->name); > - json_array_end (&json_ctx); > - > - json_array_begin (&json_ctx, "results"); > - /* Non-overlapping buffers. */ > - for (size_t i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1) > - { > - do_test (&json_ctx, i, NO_OVERLAP, 1); > - do_test (&json_ctx, i + 1, NO_OVERLAP, 1); > - } > - > - /* Partially-overlapping buffers. */ > - for (size_t i = START_SIZE; i <= MIN_PAGE_SIZE / 2; i <<= 1) > - { > - do_test (&json_ctx, i, PARTIAL_OVERLAP, 1); > - do_test (&json_ctx, i + 1, PARTIAL_OVERLAP, 1); > - } > - > - /* Complete-overlapping buffers. */ > - for (size_t i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1) > - { > - do_test (&json_ctx, i, COMPLETE_OVERLAP, 0); > - do_test (&json_ctx, i + 1, COMPLETE_OVERLAP, 0); > - } > - > - json_array_end (&json_ctx); > - json_attr_object_end (&json_ctx); > - json_attr_object_end (&json_ctx); > - json_document_end (&json_ctx); > - > - return ret; > -} > - > -#include > diff --git a/benchtests/bench-memset-walk.c b/benchtests/bench-memset-walk.c > deleted file mode 100644 > index d838b8421730a7b9b916b05f6c01529170b69a8b..0000000000000000000000000000000000000000 > --- a/benchtests/bench-memset-walk.c > +++ /dev/null > @@ -1,122 +0,0 @@ > -/* Measure memset function throughput with large data sizes. > - Copyright (C) 2017-2023 Free Software Foundation, Inc. > - This file is part of the GNU C Library. > - > - The GNU C Library is free software; you can redistribute it and/or > - modify it under the terms of the GNU Lesser General Public > - License as published by the Free Software Foundation; either > - version 2.1 of the License, or (at your option) any later version. > - > - The GNU C Library is distributed in the hope that it will be useful, > - but WITHOUT ANY WARRANTY; without even the implied warranty of > - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > - Lesser General Public License for more details. > - > - You should have received a copy of the GNU Lesser General Public > - License along with the GNU C Library; if not, see > - . */ > - > -#define TEST_MAIN > -#define TEST_NAME "memset" > -#define START_SIZE 128 > -#define MIN_PAGE_SIZE (getpagesize () + 32 * 1024 * 1024) > -#define TIMEOUT (20 * 60) > -#include "bench-string.h" > - > -#include "json-lib.h" > - > -void *generic_memset (void *, int, size_t); > -typedef void *(*proto_t) (void *, int, size_t); > - > -IMPL (MEMSET, 1) > -IMPL (generic_memset, 0) > - > -static void > -do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, CHAR *s_end, > - int c __attribute ((unused)), size_t n) > -{ > - size_t i, iters = MIN_PAGE_SIZE / n; > - timing_t start, stop, cur; > - > - TIMING_NOW (start); > - for (i = 0; i < iters && s <= s_end; s_end -= n, i++) > - CALL (impl, s, c, n); > - TIMING_NOW (stop); > - > - TIMING_DIFF (cur, start, stop); > - > - /* Get time taken per function call. */ > - json_element_double (json_ctx, (double) cur / i); > -} > - > -static void > -do_test (json_ctx_t *json_ctx, int c, size_t len) > -{ > - json_element_object_begin (json_ctx); > - json_attr_uint (json_ctx, "length", len); > - json_attr_uint (json_ctx, "char", c); > - json_array_begin (json_ctx, "timings"); > - > - FOR_EACH_IMPL (impl, 0) > - { > - do_one_test (json_ctx, impl, (CHAR *) buf1, > - (CHAR *) buf1 + MIN_PAGE_SIZE - len, c, len); > - alloc_bufs (); > - } > - > - json_array_end (json_ctx); > - json_element_object_end (json_ctx); > -} > - > -int > -test_main (void) > -{ > - json_ctx_t json_ctx; > - size_t i; > - > - test_init (); > - > - json_init (&json_ctx, 0, stdout); > - > - json_document_begin (&json_ctx); > - json_attr_string (&json_ctx, "timing_type", TIMING_TYPE); > - > - json_attr_object_begin (&json_ctx, "functions"); > - json_attr_object_begin (&json_ctx, TEST_NAME); > - json_attr_string (&json_ctx, "bench-variant", "walk"); > - > - json_array_begin (&json_ctx, "ifuncs"); > - FOR_EACH_IMPL (impl, 0) > - json_element_string (&json_ctx, impl->name); > - json_array_end (&json_ctx); > - > - json_array_begin (&json_ctx, "results"); > - for (i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1) > - { > - do_test (&json_ctx, 65, i); > - do_test (&json_ctx, 65, i + 1); > - } > - > - for (i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1) > - { > - do_test (&json_ctx, 0, i); > - do_test (&json_ctx, 0, i + 1); > - } > - > - json_array_end (&json_ctx); > - json_attr_object_end (&json_ctx); > - json_attr_object_end (&json_ctx); > - json_document_end (&json_ctx); > - > - return ret; > -} > - > -#include > - > -#define libc_hidden_builtin_def(X) > -#define libc_hidden_def(X) > -#define libc_hidden_weak(X) > -#define weak_alias(X,Y) > -#undef MEMSET > -#define MEMSET generic_memset > -#include > diff --git a/benchtests/bench-memset-zero-walk.c b/benchtests/bench-memset-zero-walk.c > deleted file mode 100644 > index 53d7d712b9976cc8da437bbe0c21cc2d266595a7..0000000000000000000000000000000000000000 > --- a/benchtests/bench-memset-zero-walk.c > +++ /dev/null > @@ -1,20 +0,0 @@ > -/* Measure memset functions for zeroing throughput with large data sizes. > - Copyright (C) 2022-2023 Free Software Foundation, Inc. > - This file is part of the GNU C Library. > - > - The GNU C Library is free software; you can redistribute it and/or > - modify it under the terms of the GNU Lesser General Public > - License as published by the Free Software Foundation; either > - version 2.1 of the License, or (at your option) any later version. > - > - The GNU C Library is distributed in the hope that it will be useful, > - but WITHOUT ANY WARRANTY; without even the implied warranty of > - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > - Lesser General Public License for more details. > - > - You should have received a copy of the GNU Lesser General Public > - License along with the GNU C Library; if not, see > - . */ > - > -#define DO_MEMSET 1 > -#include "bench-bzero-walk.c" > > > -- Cheers, Carlos.