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.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, 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 3BD341F5AE for ; Tue, 20 Jul 2021 06:34:54 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6D21B398547F for ; Tue, 20 Jul 2021 06:34:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6D21B398547F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1626762893; bh=BLjG1qEcOasJuKh4rGGCYjO6zgSq7qgzcbqp+FOt8Ik=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=tu32PyrEk9NdQ4GkyOOaajgk4oFluvkKgA71yFOIM6Ecd467oXCca7bdv7dQpyH78 JN7/JpF/BHuyH9lYk9OV7/QKs4vk0ZUSLMFTFPSiG6qAwfHKa9iAq1kfRSMBAnTQmw pon4cXJGEWTTWCrWtdLGzRNS/P5oISy3JQkLNDGw= Received: from esa10.hc1455-7.c3s2.iphmx.com (esa10.hc1455-7.c3s2.iphmx.com [139.138.36.225]) by sourceware.org (Postfix) with ESMTPS id 605913854814 for ; Tue, 20 Jul 2021 06:34:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 605913854814 IronPort-SDR: H92u5L2djbTGwIUUHji0CirljMLRrxFigIT5+6YiY5gw7ETGjs+6X7bwxv1TEvgRPgZynXUwOk K8sCQSgZqNzpR1BCjnPGe3Oofv6aQy6vzxgGjKj7Hz4RUT/YbJFcsS3vLRXzx5RWszeEywzlww NVCzUJd+W06I0/juVi03gnPullFTZ7+lwfIygDqcuOT2rTPbnKiLA+DCj2+OAft9ID3XlL1YNZ +9ou9OrAUFDel1Qw6ipIJ8Pql5xAGni7nWkBppnBn8I0O/HysyqVytl+IcOetyzz27LgWt/wrJ ql4U5q9NEHQsCFlxDUFZpCGp X-IronPort-AV: E=McAfee;i="6200,9189,10050"; a="25231272" X-IronPort-AV: E=Sophos;i="5.84,254,1620658800"; d="scan'208";a="25231272" Received: from unknown (HELO oym-r2.gw.nic.fujitsu.com) ([210.162.30.90]) by esa10.hc1455-7.c3s2.iphmx.com with ESMTP; 20 Jul 2021 15:34:30 +0900 Received: from oym-m4.gw.nic.fujitsu.com (oym-nat-oym-m4.gw.nic.fujitsu.com [192.168.87.61]) by oym-r2.gw.nic.fujitsu.com (Postfix) with ESMTP id AFDCAE60B4 for ; Tue, 20 Jul 2021 15:34:29 +0900 (JST) Received: from m3050.s.css.fujitsu.com (msm.b.css.fujitsu.com [10.134.21.208]) by oym-m4.gw.nic.fujitsu.com (Postfix) with ESMTP id D9A8E216A17 for ; Tue, 20 Jul 2021 15:34:28 +0900 (JST) Received: from bionic.lxd (unknown [10.126.53.116]) by m3050.s.css.fujitsu.com (Postfix) with ESMTP id C1C48AB; Tue, 20 Jul 2021 15:34:28 +0900 (JST) To: Noah Goldstein , Wilco Dijkstra , "Lucas A. M. Magalhaes" , libc-alpha@sourceware.org Subject: [PATCH v2 1/5] benchtests: Enable scripts/plot_strings.py to read stdin Date: Tue, 20 Jul 2021 06:34:21 +0000 Message-Id: <20210720063421.362260-1-naohirot@fujitsu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210713082214.307529-1-naohirot@fujitsu.com> References: <20210713082214.307529-1-naohirot@fujitsu.com> X-TM-AS-GCONF: 00 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: , From: Naohiro Tamura via Libc-alpha Reply-To: Naohiro Tamura Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" 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(-) 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, -- 2.17.1