From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id EEBC11F8C6 for ; Thu, 5 Aug 2021 07:57:18 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 400F23846078 for ; Thu, 5 Aug 2021 07:57:18 +0000 (GMT) Received: from eastern.birch.relay.mailchannels.net (eastern.birch.relay.mailchannels.net [23.83.209.55]) by sourceware.org (Postfix) with ESMTPS id 4FCB73857C65 for ; Thu, 5 Aug 2021 07:57:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4FCB73857C65 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id BDBFE22816; Thu, 5 Aug 2021 07:57:02 +0000 (UTC) Received: from pdx1-sub0-mail-a4.g.dreamhost.com (100-98-55-225.trex.outbound.svc.cluster.local [100.98.55.225]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 04FFB22996; Thu, 5 Aug 2021 07:57:02 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a4.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.98.55.225 (trex/6.3.3); Thu, 05 Aug 2021 07:57:02 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Sponge-Quick: 456d25aa41c9e972_1628150222479_633737678 X-MC-Loop-Signature: 1628150222479:3236612658 X-MC-Ingress-Time: 1628150222479 Received: from pdx1-sub0-mail-a4.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a4.g.dreamhost.com (Postfix) with ESMTP id 468778AAB7; Thu, 5 Aug 2021 00:57:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gotplt.org; h=subject:to :references:from:message-id:date:mime-version:in-reply-to :content-type:content-transfer-encoding; s=gotplt.org; bh=hhos4P jjZofGblzrQtmEbLbwDYw=; b=JK4Uvfu1nNqHHUzqgy7vA4ycjSvpULQHWVTBMn 8cuclpBMkv+O/I9Gna/pcJMd8EbHldskuxbtXUe1Q81bB7q6+c1mBbTtZxHLKqSx qIyxQn3Yj/wb5eEAzzOxHNOiAUAHWKlyJczj0V06sVoQKU9TsTbi0Fv1bIoosAqG 67cX0= Received: from [192.168.1.159] (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a4.g.dreamhost.com (Postfix) with ESMTPSA id 5FD8B8AAB5; Thu, 5 Aug 2021 00:56:58 -0700 (PDT) Subject: Re: [PATCH v3 1/5] benchtests: Enable scripts/plot_strings.py to read stdin To: Naohiro Tamura , libc-alpha@sourceware.org References: <20210805074733.433430-1-naohirot@fujitsu.com> <20210805074953.433483-1-naohirot@fujitsu.com> X-DH-BACKEND: pdx1-sub0-mail-a4 From: Siddhesh Poyarekar Message-ID: <0d7d4e65-0286-420f-654d-7151a349ba8f@gotplt.org> Date: Thu, 5 Aug 2021 13:26:53 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210805074953.433483-1-naohirot@fujitsu.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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: , Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On 8/5/21 1:19 PM, Naohiro Tamura via Libc-alpha wrote: > This patch enables scripts/plot_strings.py to read a benchmark result > file from stdin. > To keep backward compatibility, that is to keep accepting multiple of > benchmark result files in argument, blank argument doesn't mean stdin, > but '-' does. > Therefore nargs parameter of ArgumentParser.add_argument() method is > not changed to '?', but keep '+'. > > ex: > $ jq '.' bench-memset.out | plot_strings.py - > $ jq '.' bench-memset.out | plot_strings.py - bench-memset-large.out > $ plot_strings.py bench-memset.out bench-memset-large.out > > error ex: > $ jq '.' bench-memset.out | plot_strings.py > --- > benchtests/scripts/plot_strings.py | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) Very nice! LGTM. Reviewed-by: Siddhesh Poyarekar > > diff --git a/benchtests/scripts/plot_strings.py b/benchtests/scripts/plot_strings.py > index c71f0804e4de..ec634692d9ad 100755 > --- a/benchtests/scripts/plot_strings.py > +++ b/benchtests/scripts/plot_strings.py > @@ -31,6 +31,7 @@ import json > import matplotlib as mpl > import numpy as np > import os > +import sys > > try: > import jsonschema as validator > @@ -331,8 +332,11 @@ def main(args): > for filename in args.bench: > bench = None > > - with open(filename, "r") as f: > - bench = json.load(f) > + if filename == '-': > + bench = json.load(sys.stdin) > + else: > + with open(filename, "r") as f: > + bench = json.load(f) > > validator.validate(bench, schema) > > @@ -354,7 +358,8 @@ if __name__ == "__main__": > > # Required parameter > parser.add_argument("bench", nargs="+", > - help="benchmark results file(s) in json format") > + help="benchmark results file(s) in json format, " \ > + "and/or '-' as a benchmark result file from stdin") > > # Optional parameters > parser.add_argument("-b", "--baseline", type=str, >