From patchwork Sat Sep 16 10:11:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 814487 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-84664-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="KSd0PsM4"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xvSjT3yl4z9t2l for ; Sat, 16 Sep 2017 20:11:41 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=p+Ji7LF682l9JOghkJj2BAySlS1A85m 77ZX7rUfzcGF2WtX9bYvVIxjNUN9WY7ETx1dV76c2P8wSNExA+yfxnmQ4jiquKEk uti6U7mofmahHs2R/UlszgkfvD0cxLqsH4IN2ibMZ5gfgPbX7wVAL2Pd74AQorCa WYx8vbczfERk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=3IC9IFZ/6cBR1HwrUbfESMgTy0o=; b=KSd0P sM4IXhGui08JgHW5hwaHiIs+FWvOazZ+Qj2bXy6gLWTVQqW74kE8A89YnSeZP4se GI55TE6s6FseFmNfdTW9qIChOhgDv/+90WItE74e3rXxIP8SBn7hEu3Iqik3CgAA bMBrCEb5FDnmfwmk5LyTIb6Vi/ZoMxyt203X3c= Received: (qmail 14404 invoked by alias); 16 Sep 2017 10:11:24 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 14299 invoked by uid 89); 16 Sep 2017 10:11:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_NEUTRAL autolearn=ham version=3.3.2 spammy=Hx-languages-length:2586 X-HELO: homiemail-a114.g.dreamhost.com From: Siddhesh Poyarekar To: libc-alpha@sourceware.org Subject: [COMMITTED 3/3] benchtests: New -g option to generate graphs in compare_strings.py Date: Sat, 16 Sep 2017 15:41:06 +0530 Message-Id: <1505556666-3043-3-git-send-email-siddhesh@sourceware.org> In-Reply-To: <1505556666-3043-1-git-send-email-siddhesh@sourceware.org> References: <1505556666-3043-1-git-send-email-siddhesh@sourceware.org> The compare_strings.py option unconditionally generates a graph PNG image of the input data, which can be unnecessary and slow. Put this behind an optional flag -g. * benchtests/scripts/compare_strings.py: New option -g. (draw_graph): Print a message that a graph is being generated. (process_results): Generate graph only if -g is passed. (main): Process option -g. --- ChangeLog | 5 +++++ benchtests/scripts/compare_strings.py | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 20746e6..ea0b671 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2017-09-16 Siddhesh Poyarekar + * benchtests/scripts/compare_strings.py: New option -g. + (draw_graph): Print a message that a graph is being generated. + (process_results): Generate graph only if -g is passed. + (main): Process option -g. + * benchtests/scripts/compare_strings.py (process_results): Better spacing for output. diff --git a/benchtests/scripts/compare_strings.py b/benchtests/scripts/compare_strings.py index 1f0be3b..65119ed 100755 --- a/benchtests/scripts/compare_strings.py +++ b/benchtests/scripts/compare_strings.py @@ -57,6 +57,7 @@ def draw_graph(f, v, ifuncs, results): ifuncs: List of ifunc names results: Dictionary of results for each test criterion """ + print('Generating graph for %s, variant \'%s\'' % (f, v)) xkeys = results.keys() pylab.clf() @@ -78,7 +79,7 @@ def draw_graph(f, v, ifuncs, results): pylab.savefig('%s-%s.png' % (f, v), bbox_inches='tight') -def process_results(results, attrs, base_func): +def process_results(results, attrs, base_func, graph): """ Process results and print them Args: @@ -113,7 +114,9 @@ def process_results(results, attrs, base_func): sys.stdout.write('\t') i = i + 1 print('') - draw_graph(f, v, results['functions'][f]['ifuncs'], graph_res) + + if graph: + draw_graph(f, v, results['functions'][f]['ifuncs'], graph_res) def main(args): @@ -129,7 +132,7 @@ def main(args): attrs = args.attributes.split(',') results = parse_file(args.input, args.schema) - process_results(results, attrs, base_func) + process_results(results, attrs, base_func, args.graph) if __name__ == '__main__': @@ -147,6 +150,8 @@ if __name__ == '__main__': # Optional arguments. parser.add_argument('-b', '--base', help='IFUNC variant to set as baseline.') + parser.add_argument('-g', '--graph', action='store_true', + help='Generate a graph from results.') args = parser.parse_args() main(args)