From patchwork Mon Mar 25 15:58:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 10869595 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3925B925 for ; Mon, 25 Mar 2019 16:25:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20BEC2904A for ; Mon, 25 Mar 2019 16:25:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1455F29189; Mon, 25 Mar 2019 16:25:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AD4D22904A for ; Mon, 25 Mar 2019 16:25:37 +0000 (UTC) Received: from localhost ([127.0.0.1]:45131 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8SPp-0004rW-1F for patchwork-qemu-devel@patchwork.kernel.org; Mon, 25 Mar 2019 12:25:37 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8SGh-0003c5-Hk for qemu-devel@nongnu.org; Mon, 25 Mar 2019 12:16:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8S1q-0005fY-Gu for qemu-devel@nongnu.org; Mon, 25 Mar 2019 12:00:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56324) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8S1m-0005dH-3G; Mon, 25 Mar 2019 12:00:46 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B6CE53084266; Mon, 25 Mar 2019 16:00:43 +0000 (UTC) Received: from localhost (ovpn-116-57.ams2.redhat.com [10.36.116.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id B48DE6A6A6; Mon, 25 Mar 2019 16:00:28 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Date: Mon, 25 Mar 2019 15:58:55 +0000 Message-Id: <20190325155857.10661-6-stefanha@redhat.com> In-Reply-To: <20190325155857.10661-1-stefanha@redhat.com> References: <20190325155857.10661-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 25 Mar 2019 16:00:44 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 5/7] scripts/cleanup-trace-events: Update for current practice X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , kvm@vger.kernel.org, David Hildenbrand , Jason Wang , Mark Cave-Ayland , Michael Roth , Gerd Hoffmann , Stefano Stabellini , xen-devel@lists.xenproject.org, qemu-block@nongnu.org, Juan Quintela , Aleksandar Rikalo , Helge Deller , "Michael S. Tsirkin" , Markus Armbruster , Halil Pasic , Christian Borntraeger , Anthony Perard , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , David Gibson , Artyom Tarasenko , Eduardo Habkost , Riku Voipio , "Dr. David Alan Gilbert" , Yuval Shaia , Greg Kurz , Alex Williamson , Paul Durrant , Stefan Hajnoczi , Igor Mammedov , John Snow , Richard Henderson , Kevin Wolf , Laurent Vivier , Cornelia Huck , qemu-s390x@nongnu.org, Max Reitz , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Aleksandar Markovic , Paolo Bonzini , =?utf-8?q?Andreas_F=C3=A4rber?= , Aurelien Jarno , Stefan Berger Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Armbruster Emit comments with shortened file names (previous commit). Limit search to the input file's directory. Cope with properties tcg (commit b2b36c22bd8) and vcpu (commit 3d211d9f4db). Cope with capital letters in function names. Signed-off-by: Markus Armbruster Message-id: 20190314180929.27722-4-armbru@redhat.com Message-Id: <20190314180929.27722-4-armbru@redhat.com> Signed-off-by: Stefan Hajnoczi --- scripts/cleanup-trace-events.pl | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/cleanup-trace-events.pl b/scripts/cleanup-trace-events.pl index e93abc00da..d4f0e4cab5 100755 --- a/scripts/cleanup-trace-events.pl +++ b/scripts/cleanup-trace-events.pl @@ -13,6 +13,7 @@ use warnings; use strict; +use File::Basename; my $buf = ''; my %seen = (); @@ -23,12 +24,19 @@ sub out { %seen = (); } -while (<>) { - if (/^(disable )?([a-z_0-9]+)\(/) { - open GREP, '-|', 'git', 'grep', '-lw', "trace_$2" +$#ARGV == 0 or die "usage: $0 FILE"; +my $in = $ARGV[0]; +my $dir = dirname($in); +open(IN, $in) or die "open $in: $!"; +chdir($dir) or die "chdir $dir: $!"; + +while () { + if (/^(disable |(tcg) |vcpu )*([a-z_0-9]+)\(/i) { + my $pat = "trace_$3"; + $pat .= '_tcg' if (defined $2); + open GREP, '-|', 'git', 'grep', '-lw', '--max-depth', '1', $pat or die "run git grep: $!"; - my $fname; - while ($fname = ) { + while (my $fname = ) { chomp $fname; next if $seen{$fname} || $fname eq 'trace-events'; $seen{$fname} = 1; @@ -49,3 +57,4 @@ while (<>) { } out; +close(IN) or die "close $in: $!";