From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 396463853832 for ; Wed, 12 May 2021 18:57:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 396463853832 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14CIYWxB125672 for ; Wed, 12 May 2021 14:57:55 -0400 Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com with ESMTP id 38gkcn29fu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 12 May 2021 14:57:55 -0400 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 14CImFs2006932 for ; Wed, 12 May 2021 18:57:55 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma04wdc.us.ibm.com with ESMTP id 38dj99fjjk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 12 May 2021 18:57:55 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 14CIvstJ26804626 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 May 2021 18:57:54 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 13449C605A; Wed, 12 May 2021 18:57:54 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 91BF7C6055; Wed, 12 May 2021 18:57:53 +0000 (GMT) Received: from localhost (unknown [9.85.179.12]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 12 May 2021 18:57:53 +0000 (GMT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20210512142717.225429-1-msc@linux.ibm.com> References: <20210512142717.225429-1-msc@linux.ibm.com> Subject: Re: [PATCH 1/2] benchtests: Use JSON for bench-rawmemchr output From: "Lucas A. M. Magalhaes" To: Matheus Castanho , libc-alpha@sourceware.org Date: Wed, 12 May 2021 15:57:49 -0300 Message-ID: <162084586948.359543.11900529453537059768@fedora.local> User-Agent: alot/0.9.1 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 1sJlwbjV8pW9QF0KDcCw5y07auyeryFP X-Proofpoint-ORIG-GUID: 1sJlwbjV8pW9QF0KDcCw5y07auyeryFP X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-05-12_09:2021-05-12, 2021-05-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 adultscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105120120 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 18:57:58 -0000 Hi Matheus, IMO the patches of this patch set are unrelated and should be submitted separated. This patch, LGTM. Test the benchmark and the JSON is well formatted. Reviewed-by: Lucas A. M. Magalhaes Quoting Matheus Castanho via Libc-alpha (2021-05-12 11:27:16) > Convert the output of benchtests/bench-rawmemchr to JSON like other string > benchmarks. This makes the output more parseable and allows usage of > compare_strings.py, for example. > --- > benchtests/bench-rawmemchr.c | 54 ++++++++++++++++++++++++++---------- > 1 file changed, 39 insertions(+), 15 deletions(-) >=20 > diff --git a/benchtests/bench-rawmemchr.c b/benchtests/bench-rawmemchr.c > index 93b4a1ea38..80286b04b0 100644 > --- a/benchtests/bench-rawmemchr.c > +++ b/benchtests/bench-rawmemchr.c > @@ -23,6 +23,8 @@ > #define TEST_NAME "rawmemchr" > #include "bench-string.h" > =20 > +#include "json-lib.h" > + Ok. > typedef char *(*proto_t) (const char *, int); > =20 > char * > @@ -37,7 +39,7 @@ IMPL (rawmemchr, 1) > IMPL (generic_rawmemchr, 0) > =20 > static void > -do_one_test (impl_t *impl, const char *s, int c, char *exp_res) > +do_one_test (json_ctx_t *json_ctx, impl_t *impl, const char *s, int c, c= har *exp_res) > { Ok. > size_t i, iters =3D INNER_LOOP_ITERS_LARGE * 4; > timing_t start, stop, cur; > @@ -59,11 +61,11 @@ do_one_test (impl_t *impl, const char *s, int c, char= *exp_res) > =20 > TIMING_DIFF (cur, start, stop); > =20 > - TIMING_PRINT_MEAN ((double) cur, (double) iters); > + json_element_double (json_ctx, (double) cur / (double) iters); Ok. > } > =20 > static void > -do_test (size_t align, size_t pos, size_t len, int seek_char) > +do_test (json_ctx_t *json_ctx, size_t align, size_t pos, size_t len, int= seek_char) OK. > { > size_t i; > char *result; > @@ -86,39 +88,61 @@ do_test (size_t align, size_t pos, size_t len, int se= ek_char) > buf1[align + len] =3D -seek_char; > result =3D (char *) (buf1 + align + pos); > =20 > - printf ("Length %4zd, alignment %2zd:", pos, align); > + json_element_object_begin (json_ctx); > + json_attr_uint (json_ctx, "length", pos); > + json_attr_uint (json_ctx, "alignment", align); > + json_attr_uint (json_ctx, "char", seek_char); > + json_array_begin (json_ctx, "timings"); OK. > =20 > FOR_EACH_IMPL (impl, 0) > - do_one_test (impl, (char *) (buf1 + align), seek_char, result); > + do_one_test (json_ctx, impl, (char *) (buf1 + align), seek_char, res= ult); Ok. > =20 > - putchar ('\n'); > + json_array_end (json_ctx); > + json_element_object_end (json_ctx); Ok. > } > =20 > int > test_main (void) > { > + json_ctx_t json_ctx; Ok. > size_t i; > =20 > test_init (); > =20 > - printf ("%20s", ""); > + 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", ""); > + > + json_array_begin (&json_ctx, "ifuncs"); Ok. > FOR_EACH_IMPL (impl, 0) > - printf ("\t%s", impl->name); > - putchar ('\n'); > + json_element_string (&json_ctx, impl->name); > + json_array_end (&json_ctx); > + > + json_array_begin (&json_ctx, "results"); Ok. > =20 > for (i =3D 1; i < 7; ++i) > { > - do_test (0, 16 << i, 2048, 23); > - do_test (i, 64, 256, 23); > - do_test (0, 16 << i, 2048, 0); > - do_test (i, 64, 256, 0); > + do_test (&json_ctx, 0, 16 << i, 2048, 23); > + do_test (&json_ctx, i, 64, 256, 23); > + do_test (&json_ctx, 0, 16 << i, 2048, 0); > + do_test (&json_ctx, i, 64, 256, 0); > } > for (i =3D 1; i < 32; ++i) > { > - do_test (0, i, i + 1, 23); > - do_test (0, i, i + 1, 0); > + do_test (&json_ctx, 0, i, i + 1, 23); > + do_test (&json_ctx, 0, i, i + 1, 0); > } Ok. > =20 > + json_array_end (&json_ctx); > + json_attr_object_end (&json_ctx); > + json_attr_object_end (&json_ctx); > + json_document_end (&json_ctx); > + OK. > return ret; > } > =20 > --=20 > 2.31.1 >