Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752653AbbGGCpH (ORCPT ); Mon, 6 Jul 2015 22:45:07 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:41720 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751289AbbGGCo4 (ORCPT ); Mon, 6 Jul 2015 22:44:56 -0400 Message-ID: <559B3CC3.2030503@huawei.com> Date: Tue, 7 Jul 2015 10:43:15 +0800 From: "Wangnan (F)" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Arnaldo Carvalho de Melo , pi3orama CC: "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" , "rostedt@goodmis.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] perf record: Allow passing perf's own pid to '--filter' References: <1436156251-147535-1-git-send-email-wangnan0@huawei.com> <20150706135650.GG16826@kernel.org> <03223997-411B-4C5E-B03D-080F40EE76D6@163.com> <20150706154035.GI16826@kernel.org> In-Reply-To: <20150706154035.GI16826@kernel.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.559B3CDE.0015,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 3f64552d4227db271398ed7dffc3123a Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2718 Lines: 72 On 2015/7/6 23:40, Arnaldo Carvalho de Melo wrote: > Em Mon, Jul 06, 2015 at 11:00:10PM +0800, pi3orama escreveu: >> 发自我的 iPhone > >>> 在 2015年7月6日,下午9:56,Arnaldo Carvalho de Melo 写道: >>> I.e. having something in the filter expression that gets transformed >>> into the tools' pid, I have no problem with that, just curious about >>> what would be the best character to signal that a substitution needs to >>> be performed, if it is really '@VAR', as my first selection would be >>> '$VAR', > >> $ has special meaning for shell. Using $ in cmdline require users use escaping or '' quoted string. Therefore I believe @ should be better. What do you think? > Yeah, that gets in the way, as it gets in the way for '!', i.e. > negating, and even tho, that is what is used in strace (and in 'perf > trace'): > > strace -e \!open,write ls > > Or: > > strace -e '!open,write' ls > > But apart from that, it would be good if expressions used in 'perf > probe' and here could have as much as possible the same semantics for > those markers, i.e. 'perf probe' already uses @ for some stuff, probably > the meaning is for "at", i.e. something at some place. > > '$' strongly associated with variables, so I don't think it would be a > big problem to enclose expressions where variables (we may end having > others, no?) in '', i.e. > > perf record -e sched:*switch --filter 'common_pid != $PERF_PID' -a > > Doesn't look so ugly or cumbersome :-) But what about user want to use real shell variables also? perf record -e raw_syscalls:* "common_pid !="'$PERF_PID'" && common_pid != $X_PID" Or perf record -e raw_syscalls:* "common_pid !=\$PERF_PID && common_pid != $X_PID" right? However, since you and Steven prefer '$' than '@' and '@' has its own meaning 'at' in 'perf probe', I'll use '$' in my next version. I looked your new code. You added perf_evsel__append_filter() to enable us append a filter expression in '(%s) (%s)' manner, and also perf_evlist__set_filter_pid() to add 'common_pid != %d' expression. They are nice scaffolds if we'd like to add a new cmdline option '--filter-pids' and '--filter-perf'. However, I think we should let users who use --filter take full control of their filters, instead of providing many helpers which can do similar things to confuse them. So I decide not to use those functions you added these days in my next version. Thank you. > > - Arnaldo -- 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/