All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: "平松雅巳 / HIRAMATU,MASAMI" <masami.hiramatsu.pt@hitachi.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Jiri Olsa <jolsa@redhat.com>, LKML <linux-kernel@vger.kernel.org>,
	Wang Nan <wangnan0@huawei.com>
Subject: Re: [RFC/PATCH 2/3] perf probe: Rename __event_package to probe_event_package
Date: Fri, 4 Sep 2015 15:09:47 +0900	[thread overview]
Message-ID: <20150904060947.GA2771@sejong> (raw)
In-Reply-To: <50399556C9727B4D88A595C8584AAB375250BD03@GSjpTKYDCembx32.service.hitachi.net>

On Fri, Sep 04, 2015 at 02:11:09AM +0000, 平松雅巳 / HIRAMATU,MASAMI wrote:
> > From: Namhyung Kim [mailto:namhyung@gmail.com] On Behalf Of Namhyung Kim
> > 
> > The struct __event_package can be accessed now from other than
> > probe-event.c code.  So rename it to more specific name.
> > 
> > Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > ---
> >  tools/perf/util/probe-event.c | 18 ++++++------------
> >  tools/perf/util/probe-event.h | 10 ++++++++++
> >  2 files changed, 16 insertions(+), 12 deletions(-)
> > 
> > diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> > index 8eaa03428d72..eef39338bb2a 100644
> > --- a/tools/perf/util/probe-event.c
> > +++ b/tools/perf/util/probe-event.c
> > @@ -2759,20 +2759,14 @@ static int convert_to_probe_trace_events(struct perf_probe_event *pev,
> >  	return find_probe_trace_events_from_map(pev, tevs);
> >  }
> > 
> > -struct __event_package {
> > -	struct perf_probe_event		*pev;
> > -	struct probe_trace_event	*tevs;
> > -	int				ntevs;
> > -};
> > -
> > -static int __add_perf_probe_events(struct perf_probe_event *pevs, int npevs,
> > -				   struct __event_package **ppkgs)
> > +int __add_perf_probe_events(struct perf_probe_event *pevs, int npevs,
> > +			    struct probe_event_package **ppkgs)
> 
> OK, since now we have probe_event_package object, this function should be
> refactored as pkgs = probe_event_packages__new(pevs, npevs)(allocate, initialize)
> , probe_event_packages__convert(pkgs) and probe_event_packages__apply(pkgs).

I think it'd be better using Wang Nan's patch below.

  https://lkml.org/lkml/2015/8/29/25

I'll send v2 with this change.

Thanks,
Namhyung


> 
> >  {
> >  	int i, ret;
> > -	struct __event_package *pkgs;
> > +	struct probe_event_package *pkgs;
> > 
> >  	ret = 0;
> > -	pkgs = zalloc(sizeof(struct __event_package) * npevs);
> > +	pkgs = zalloc(sizeof(struct probe_event_package) * npevs);
> > 
> >  	if (pkgs == NULL)
> >  		return -ENOMEM;
> > @@ -2813,7 +2807,7 @@ static int __add_perf_probe_events(struct perf_probe_event *pevs, int npevs,
> >  	return 0;
> >  }
> > 
> > -static void cleanup_perf_probe_events(struct __event_package *pkgs, int npevs)
> > +void cleanup_perf_probe_events(struct probe_event_package *pkgs, int npevs)
> 
> This also should be perf_event_pacakges__delete() :)
> 
> Thanks!
> 
> >  {
> >  	int i, j;
> > 
> > @@ -2833,7 +2827,7 @@ static void cleanup_perf_probe_events(struct __event_package *pkgs, int npevs)
> >  int add_perf_probe_events(struct perf_probe_event *pevs, int npevs)
> >  {
> >  	int ret;
> > -	struct __event_package *pkgs = NULL;
> > +	struct probe_event_package *pkgs = NULL;
> > 
> >  	ret = __add_perf_probe_events(pevs, npevs, &pkgs);
> >  	cleanup_perf_probe_events(pkgs, npevs);
> > diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h
> > index 6e7ec68a4aa8..73f922fa7cac 100644
> > --- a/tools/perf/util/probe-event.h
> > +++ b/tools/perf/util/probe-event.h
> > @@ -89,6 +89,12 @@ struct perf_probe_event {
> >  	struct perf_probe_arg	*args;	/* Arguments */
> >  };
> > 
> > +struct probe_event_package {
> > +	struct perf_probe_event		*pev;
> > +	struct probe_trace_event	*tevs;
> > +	int				ntevs;
> > +};
> > +
> >  /* Line range */
> >  struct line_range {
> >  	char			*file;		/* File name */
> > @@ -138,6 +144,10 @@ extern void line_range__clear(struct line_range *lr);
> >  extern int line_range__init(struct line_range *lr);
> > 
> >  extern int add_perf_probe_events(struct perf_probe_event *pevs, int npevs);
> > +extern int __add_perf_probe_events(struct perf_probe_event *pevs, int npevs,
> > +				   struct probe_event_package **ppkgs);
> > +extern void cleanup_perf_probe_events(struct probe_event_package *pkgs,
> > +				      int npevs);
> >  extern int del_perf_probe_events(struct strfilter *filter);
> >  extern int show_perf_probe_events(struct strfilter *filter);
> >  extern int show_line_range(struct line_range *lr, const char *module,
> > --
> > 2.5.0
> 

  reply	other threads:[~2015-09-04  6:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-03 17:28 [RFC/PATCH 1/3] perf probe: Split add_perf_probe_events() Namhyung Kim
2015-09-03 17:28 ` [RFC/PATCH 2/3] perf probe: Rename __event_package to probe_event_package Namhyung Kim
2015-09-04  2:11   ` 平松雅巳 / HIRAMATU,MASAMI
2015-09-04  6:09     ` Namhyung Kim [this message]
2015-09-04  7:55       ` 平松雅巳 / HIRAMATU,MASAMI
2015-09-03 17:28 ` [RFC/PATCH 3/3] perf probe: Move print logic into cmd_probe() Namhyung Kim
2015-09-04  2:17   ` 平松雅巳 / HIRAMATU,MASAMI
2015-09-04  2:11 ` [RFC/PATCH 1/3] perf probe: Split add_perf_probe_events() 平松雅巳 / HIRAMATU,MASAMI

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=20150904060947.GA2771@sejong \
    --to=namhyung@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@kernel.org \
    --cc=wangnan0@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 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.