From: "Wangnan (F)" <wangnan0@huawei.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>, pi3orama <pi3orama@163.com>
Cc: "a.p.zijlstra@chello.nl" <a.p.zijlstra@chello.nl>,
"mingo@redhat.com" <mingo@redhat.com>,
"jolsa@kernel.org" <jolsa@kernel.org>,
"peterz@infradead.org" <peterz@infradead.org>,
"namhyung@kernel.org" <namhyung@kernel.org>,
"kan.liang@intel.com" <kan.liang@intel.com>,
"adrian.hunter@intel.com" <adrian.hunter@intel.com>,
"ak@linux.intel.com" <ak@linux.intel.com>,
"cody@linux.vnet.ibm.com" <cody@linux.vnet.ibm.com>,
"jacob.w.shin@gmail.com" <jacob.w.shin@gmail.com>,
"standby24x7@gmail.com" <standby24x7@gmail.com>,
"lizefan@huawei.com" <lizefan@huawei.com>,
"yunlong.song@huawei.com" <yunlong.song@huawei.com>,
"rostedt@goodmis.org" <rostedt@goodmis.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] perf record: Allow passing perf's own pid to '--filter'
Date: Tue, 7 Jul 2015 10:43:15 +0800 [thread overview]
Message-ID: <559B3CC3.2030503@huawei.com> (raw)
In-Reply-To: <20150706154035.GI16826@kernel.org>
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 <acme@kernel.org> 写道:
>>> 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) <op> (%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
next prev parent reply other threads:[~2015-07-07 2:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-06 4:17 Wang Nan
2015-07-06 13:56 ` Arnaldo Carvalho de Melo
2015-07-06 15:00 ` pi3orama
2015-07-06 15:40 ` Arnaldo Carvalho de Melo
2015-07-07 2:43 ` Wangnan (F) [this message]
2015-07-07 14:55 ` Arnaldo Carvalho de Melo
2015-07-06 16:37 ` Steven Rostedt
2015-07-06 18:58 ` Arnaldo Carvalho de Melo
2015-07-06 15:55 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=559B3CC3.2030503@huawei.com \
--to=wangnan0@huawei.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=cody@linux.vnet.ibm.com \
--cc=jacob.w.shin@gmail.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=pi3orama@163.com \
--cc=rostedt@goodmis.org \
--cc=standby24x7@gmail.com \
--cc=yunlong.song@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome