Re: [PATCH 06/10] perf sort: Drop ip_[lr] arguments from_sort__sym_cmp()

From: Arnaldo Carvalho de Melo
Date: Fri Jan 11 2013 - 16:19:32 EST


Stephane, can you take a look at this one and provide feedback?

- Arnaldo

Em Thu, Dec 27, 2012 at 06:11:43PM +0900, Namhyung Kim escreveu:
> From: Namhyung Kim <namhyung.kim@xxxxxxx>
>
> Current _sort__sym_cmp() function is used for comparing symbols
> between two hist entries on symbol, symbol_from and symbol_to sort
> keys. Those functions pass addresses of symbols but it's meaningless
> since it gets over-written inside of the _sort__sym_cmp function to a
> start address of the symbol. So just get rid of them.
>
> This might cause a difference than prior output for branch stacks
> since it seems not using start address of the symbol but branch
> address. However AFAICS it'd be same as it gets overwritten anyway.
>
> Also remove redundant part of code in sort__sym_cmp().
>
> Cc: Stephane Eranian <eranian@xxxxxxxxxx>
> Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
> ---
> tools/perf/util/sort.c | 23 ++++++-----------------
> 1 file changed, 6 insertions(+), 17 deletions(-)
>
> diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
> index a36051b34901..c02964cabdd0 100644
> --- a/tools/perf/util/sort.c
> +++ b/tools/perf/util/sort.c
> @@ -160,9 +160,10 @@ struct sort_entry sort_dso = {
>
> /* --sort symbol */
>
> -static int64_t _sort__sym_cmp(struct symbol *sym_l, struct symbol *sym_r,
> - u64 ip_l, u64 ip_r)
> +static int64_t _sort__sym_cmp(struct symbol *sym_l, struct symbol *sym_r)
> {
> + u64 ip_l, ip_r;
> +
> if (!sym_l || !sym_r)
> return cmp_null(sym_l, sym_r);
>
> @@ -178,21 +179,10 @@ static int64_t _sort__sym_cmp(struct symbol *sym_l, struct symbol *sym_r,
> static int64_t
> sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
> {
> - u64 ip_l, ip_r;
> -
> if (!left->ms.sym && !right->ms.sym)
> return right->level - left->level;
>
> - if (!left->ms.sym || !right->ms.sym)
> - return cmp_null(left->ms.sym, right->ms.sym);
> -
> - if (left->ms.sym == right->ms.sym)
> - return 0;
> -
> - ip_l = left->ms.sym->start;
> - ip_r = right->ms.sym->start;
> -
> - return _sort__sym_cmp(left->ms.sym, right->ms.sym, ip_l, ip_r);
> + return _sort__sym_cmp(left->ms.sym, right->ms.sym);
> }
>
> static int _hist_entry__sym_snprintf(struct map *map, struct symbol *sym,
> @@ -380,8 +370,7 @@ sort__sym_from_cmp(struct hist_entry *left, struct hist_entry *right)
> if (!from_l->sym && !from_r->sym)
> return right->level - left->level;
>
> - return _sort__sym_cmp(from_l->sym, from_r->sym, from_l->addr,
> - from_r->addr);
> + return _sort__sym_cmp(from_l->sym, from_r->sym);
> }
>
> static int64_t
> @@ -393,7 +382,7 @@ sort__sym_to_cmp(struct hist_entry *left, struct hist_entry *right)
> if (!to_l->sym && !to_r->sym)
> return right->level - left->level;
>
> - return _sort__sym_cmp(to_l->sym, to_r->sym, to_l->addr, to_r->addr);
> + return _sort__sym_cmp(to_l->sym, to_r->sym);
> }
>
> static int hist_entry__sym_from_snprintf(struct hist_entry *self, char *bf,
> --
> 1.7.11.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/