Re: [PATCH 01/21] perf tools: Introduce struct add_entry_iter

2014-01-06 Thread Jiri Olsa
On Mon, Jan 06, 2014 at 05:03:22PM +0900, Namhyung Kim wrote: > On Sun, 5 Jan 2014 16:55:10 +0100, Jiri Olsa wrote: > > On Tue, Dec 24, 2013 at 05:22:07PM +0900, Namhyung Kim wrote: > >> From: Namhyung Kim > > > > SNIP > > > >> + > >> +out: > >> + iter->curr++; > >> + return err; > >> +} > >> +

Re: [PATCH 01/21] perf tools: Introduce struct add_entry_iter

2014-01-06 Thread Namhyung Kim
On Sun, 5 Jan 2014 16:55:10 +0100, Jiri Olsa wrote: > On Tue, Dec 24, 2013 at 05:22:07PM +0900, Namhyung Kim wrote: >> From: Namhyung Kim > > SNIP > >> + >> +out: >> +iter->curr++; >> +return err; >> +} >> + >> +static int >> +iter_finish_branch_entry(struct add_entry_iter *iter, >> +

Re: [PATCH 01/21] perf tools: Introduce struct add_entry_iter

2014-01-05 Thread Namhyung Kim
On Sun, 5 Jan 2014 16:28:15 +0100, Jiri Olsa wrote: > On Tue, Dec 24, 2013 at 05:22:07PM +0900, Namhyung Kim wrote: >> From: Namhyung Kim >> +iter->rep = rep; >> +ret = perf_evsel__add_entry(evsel, &al, sample, machine, iter); > > you dont need to pass machine pointer, it's already in 'al'

Re: [PATCH 01/21] perf tools: Introduce struct add_entry_iter

2014-01-05 Thread Namhyung Kim
On Sun, 5 Jan 2014 15:55:42 +0100, Jiri Olsa wrote: > On Tue, Dec 24, 2013 at 05:22:07PM +0900, Namhyung Kim wrote: >> From: Namhyung Kim >> +static int >> +iter_finish_branch_entry(struct add_entry_iter *iter, >> + struct addr_location *al __maybe_unused) >> +{ >> +free(it

Re: [PATCH 01/21] perf tools: Introduce struct add_entry_iter

2014-01-05 Thread Jiri Olsa
On Tue, Dec 24, 2013 at 05:22:07PM +0900, Namhyung Kim wrote: > From: Namhyung Kim SNIP > + > +out: > + iter->curr++; > + return err; > +} > + > +static int > +iter_finish_branch_entry(struct add_entry_iter *iter, > + struct addr_location *al __maybe_unused) > +{ > +

Re: [PATCH 01/21] perf tools: Introduce struct add_entry_iter

2014-01-05 Thread Jiri Olsa
On Tue, Dec 24, 2013 at 05:22:07PM +0900, Namhyung Kim wrote: > From: Namhyung Kim SNIP > @@ -239,6 +426,7 @@ static int process_sample_event(struct perf_tool *tool, > { > struct report *rep = container_of(tool, struct report, tool); > struct addr_location al; > + struct add_ent

Re: [PATCH 01/21] perf tools: Introduce struct add_entry_iter

2014-01-05 Thread Jiri Olsa
On Tue, Dec 24, 2013 at 05:22:07PM +0900, Namhyung Kim wrote: > From: Namhyung Kim SNIP > - return err; > + goto out; > + > + err = addr_map_symbol__inc_samples(&bx->to, evsel->idx); > + if (err) > + goto out; > + > + evsel->hists.stats.total_perio

[PATCH 01/21] perf tools: Introduce struct add_entry_iter

2013-12-24 Thread Namhyung Kim
From: Namhyung Kim There're some duplicate code when adding hist entries. They are different in that some have branch info or mem info but generally do same thing. So introduce new struct add_entry_iter and add callbacks to customize each case in general way. The new perf_evsel__add_entry() fu