All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	linux-kernel@vger.kernel.org,
	Tom Zanussi <tom.zanussi@linux.intel.com>,
	Ravi Bangoria <ravi.bangoria@linux.ibm.com>,
	Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH 2/5] perf probe: Generate event name with line number
Date: Thu, 7 Nov 2019 10:55:07 -0300	[thread overview]
Message-ID: <20191107135507.GE11372@kernel.org> (raw)
In-Reply-To: <20191107224341.9b8d91e010913386f95b3cd3@kernel.org>

Em Thu, Nov 07, 2019 at 10:43:41PM +0900, Masami Hiramatsu escreveu:
> Hi Arnaldo,
> 
> On Wed, 6 Nov 2019 16:54:32 -0300
> Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> 
> > Em Tue, Nov 05, 2019 at 09:16:59AM +0900, Masami Hiramatsu escreveu:
> > > Generate event name from function name with line number
> > > as <function>_L<line_number>. Note that this is only for
> > > the new event which is defined by function and lines.
> > > 
> > > If there is another event on same line, you have to use
> > > "-f" option. In that case, the new event has "_1" suffix.
> > 
> > So I don't like this, the existing practice of, if given a function
> > name, just create the probe:name looks more natural, if one states
> > kernel:1, then, sure, appending L1 to them is natural, better than the
> > previous naming convention,
> 
> OK, then what about adding L* only when the user add it on a
> specific line (like kernel_read:1) ?
> IOW, _L0 will be skipped.

Exactly, agreed.
 
> Thank you,
> 
> > 
> > Thanks,
> > 
> > - Arnaldo
> >  
> > >  e.g.
> > >   # perf probe -a kernel_read
> > >   Added new event:
> > >     probe:kernel_read_L0 (on kernel_read)
> > > 
> > >   You can now use it in all perf tools, such as:
> > > 
> > >   	perf record -e probe:kernel_read_L0 -aR sleep 1
> > > 
> > >   # perf probe -a kernel_read:1
> > >   Added new events:
> > >     probe:kernel_read_L1 (on kernel_read:1)
> > > 
> > >   You can now use it in all perf tools, such as:
> > > 
> > >   	perf record -e probe:kernel_read_L1_1 -aR sleep 1
> > > 
> > >   # perf probe -l
> > >     probe:kernel_read_L0 (on kernel_read@linux/linux/fs/read_write.c)
> > >     probe:kernel_read_L1 (on kernel_read@linux/linux/fs/read_write.c)
> > > 
> > > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> > > ---
> > >  tools/perf/util/probe-event.c |    8 ++++++++
> > >  1 file changed, 8 insertions(+)
> > > 
> > > diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> > > index 91cab5f669d2..d14b970a6461 100644
> > > --- a/tools/perf/util/probe-event.c
> > > +++ b/tools/perf/util/probe-event.c
> > > @@ -1679,6 +1679,14 @@ int parse_perf_probe_command(const char *cmd, struct perf_probe_event *pev)
> > >  	if (ret < 0)
> > >  		goto out;
> > >  
> > > +	/* Generate event name if needed */
> > > +	if (!pev->event && pev->point.function
> > > +			&& !pev->point.lazy_line && !pev->point.offset) {
> > > +		if (asprintf(&pev->event, "%s_L%d", pev->point.function,
> > > +			pev->point.line) < 0)
> > > +			return -ENOMEM;
> > > +	}
> > > +
> > >  	/* Copy arguments and ensure return probe has no C argument */
> > >  	pev->nargs = argc - 1;
> > >  	pev->args = zalloc(sizeof(struct perf_probe_arg) * pev->nargs);
> > 
> > -- 
> > 
> > - Arnaldo
> 
> 
> -- 
> Masami Hiramatsu <mhiramat@kernel.org>

-- 

- Arnaldo

  reply	other threads:[~2019-11-07 13:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05  0:16 [PATCH 0/5] perf/probe: Support multiprobe and immediates Masami Hiramatsu
2019-11-05  0:16 ` [PATCH 1/5] perf probe: Return a better scope DIE if there is no best scope Masami Hiramatsu
2019-11-06 19:51   ` Arnaldo Carvalho de Melo
2019-11-12 11:17   ` [tip: perf/core] " tip-bot2 for Masami Hiramatsu
2019-11-05  0:16 ` [PATCH 2/5] perf probe: Generate event name with line number Masami Hiramatsu
2019-11-06 19:54   ` Arnaldo Carvalho de Melo
2019-11-07 13:43     ` Masami Hiramatsu
2019-11-07 13:55       ` Arnaldo Carvalho de Melo [this message]
2019-11-05  0:17 ` [PATCH 3/5] perf probe: Support multiprobe event Masami Hiramatsu
2019-11-06 19:56   ` Arnaldo Carvalho de Melo
2019-11-07 13:47     ` Masami Hiramatsu
2019-11-05  0:17 ` [PATCH 4/5] perf probe: Support DW_AT_const_value constant value Masami Hiramatsu
2019-11-06 19:56   ` Arnaldo Carvalho de Melo
2019-11-05  0:17 ` [PATCH 5/5] perf probe: Trace a magic number if variable is not found Masami Hiramatsu
2019-11-06 20:00   ` Arnaldo Carvalho de Melo

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=20191107135507.GE11372@kernel.org \
    --to=arnaldo.melo@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=ravi.bangoria@linux.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=tom.zanussi@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.