Messages in this thread | | | Date | Mon, 26 May 2014 20:27:43 +0200 | From | Jiri Olsa <> | Subject | Re: [PATCH 01/26] perf tools: Introduce struct hist_entry_iter |
| |
On Fri, May 23, 2014 at 07:03:58PM +0900, Namhyung Kim wrote:
SNIP
> static int process_sample_event(struct perf_tool *tool, > union perf_event *event, > struct perf_sample *sample, > @@ -243,6 +84,9 @@ static int process_sample_event(struct perf_tool *tool, > { > struct report *rep = container_of(tool, struct report, tool); > struct addr_location al; > + struct hist_entry_iter iter = { > + .hide_unresolved = rep->hide_unresolved, > + }; > int ret; > > if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) { > @@ -257,22 +101,22 @@ static int process_sample_event(struct perf_tool *tool, > if (rep->cpu_list && !test_bit(sample->cpu, rep->cpu_bitmap)) > return 0; > > - if (sort__mode == SORT_MODE__BRANCH) { > - ret = report__add_branch_hist_entry(rep, &al, sample, evsel); > - if (ret < 0) > - pr_debug("problem adding lbr entry, skipping event\n"); > - } else if (rep->mem_mode == 1) { > - ret = report__add_mem_hist_entry(rep, &al, sample, evsel); > - if (ret < 0) > - pr_debug("problem adding mem entry, skipping event\n"); > - } else { > - if (al.map != NULL) > - al.map->dso->hit = 1; > - > - ret = report__add_hist_entry(rep, evsel, &al, sample); > - if (ret < 0) > - pr_debug("problem incrementing symbol period, skipping event\n"); > - } > + if (sort__mode == SORT_MODE__BRANCH) > + iter.ops = &hist_iter_branch; > + else if (rep->mem_mode) > + iter.ops = &hist_iter_mem; > + else > + iter.ops = &hist_iter_normal; > + > + if (al.map != NULL) > + al.map->dso->hit = 1; > + > + rep->nr_entries++;
hum, should we call report__inc_stats instead? aaand...
> + > + ret = hist_entry_iter__add(&iter, &al, evsel, sample, rep->max_stack); > + if (ret < 0) > + pr_debug("problem adding hist entry, skipping event\n"); > +
... in here?
> return ret; > }
jirka
| |