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

jirka
> +
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to