On Thu, 23 Jan 2014 15:56:54 +0100, Jiri Olsa wrote: > On Thu, Jan 23, 2014 at 09:13:45AM +0900, Namhyung Kim wrote: >> 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 hist_entry_iter and add callbacks >> to customize each case in general way. >> > > SNIP > >> >> - if (sort__mode == SORT_MODE__BRANCH) { >> - ret = report__add_branch_hist_entry(tool, &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(tool, &al, sample, evsel, >> event); >> - 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(tool, 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 == 1) > > nit.. mem_mode is bool
Ah, right! As you can see the old code already did it. ;-p Thanks, Namhyung -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/