Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755958AbbGFQhJ (ORCPT ); Mon, 6 Jul 2015 12:37:09 -0400 Received: from smtprelay0096.hostedemail.com ([216.40.44.96]:60784 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751251AbbGFQhG (ORCPT ); Mon, 6 Jul 2015 12:37:06 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::::::::::::::::::,RULES_HIT:41:334:355:368:369:379:541:599:800:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1431:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3871:3874:4250:4321:4605:5007:6117:6119:6261:6742:7875:7903:9149:10004:10400:10848:10967:11026:11232:11658:11914:12043:12517:12519:12740:13069:13311:13357:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: berry45_5ac7a39e84641 X-Filterd-Recvd-Size: 2926 Date: Mon, 6 Jul 2015 12:37:02 -0400 From: Steven Rostedt To: Arnaldo Carvalho de Melo Cc: Wang Nan , a.p.zijlstra@chello.nl, mingo@redhat.com, jolsa@kernel.org, peterz@infradead.org, namhyung@kernel.org, kan.liang@intel.com, adrian.hunter@intel.com, ak@linux.intel.com, cody@linux.vnet.ibm.com, jacob.w.shin@gmail.com, standby24x7@gmail.com, lizefan@huawei.com, yunlong.song@huawei.com, linux-kernel@vger.kernel.org, pi3orama@163.com Subject: Re: [PATCH] perf record: Allow passing perf's own pid to '--filter' Message-ID: <20150706123702.6c0a361a@gandalf.local.home> In-Reply-To: <20150706135650.GG16826@kernel.org> References: <1436156251-147535-1-git-send-email-wangnan0@huawei.com> <20150706135650.GG16826@kernel.org> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1921 Lines: 65 On Mon, 6 Jul 2015 10:56:50 -0300 Arnaldo Carvalho de Melo wrote: > Em Mon, Jul 06, 2015 at 04:17:31AM +0000, Wang Nan escreveu: > > This patch allows passing perf's own PID to '--filter' by using > > '@PERFPID'. This should be useful when system-widely capturing > > tracepoints events. > > Steven, does filters have any special meaning for @? Not as of yet. > > > Before this patch, when doing something like: > > > > # perf record -a -e syscalls:sys_enter_write > > > > One could easily get result like this: > > > > # /tmp/perf report --stdio > > ... > > # Overhead Command Shared Object Symbol > > # ........ ....... .................. .................... > > # > > 99.99% perf libpthread-2.18.so [.] __write_nocancel > > 0.01% ls libc-2.18.so [.] write > > 0.01% sshd libc-2.18.so [.] write > > ... > > > > Where most events are generated by perf itself. > > > > A shell trick can be done to filter perf itself out: > > > > # cat << EOF > ./tmp > > > #!/bin/sh > > > exec perf record -e ... --filter="common_pid != \$\$" -a sleep 10 > > > EOF > > # chmod a+x ./tmp > > # ./tmp > > > > However, doing so is user unfriendly. > > > > This patch introduces '@PERFPID' placeholder to '--filter' options. Now > > user is allowed to the above work with: > > > > # perf record -e ... --filter="common_pid != @PERFPID' sleep 10 What about using '$' instead. That is more common to shell scripts of being a variable. -- Steve > > > > Signed-off-by: Wang Nan > > --- > > tools/perf/Documentation/perf-record.txt | 1 + > > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/