lkml.org 
[lkml]   [2014]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 12/20] perf tools: Add ->sort() member to struct sort_entry
On Mon, May 12, 2014 at 03:28:45PM +0900, Namhyung Kim wrote:

SNIP

> +static int64_t
> +sort__sym_sort(struct hist_entry *left, struct hist_entry *right)
> +{
> + if (!left->ms.sym || !right->ms.sym)
> + return cmp_null(left->ms.sym, right->ms.sym);
> +
> + return strcmp(right->ms.sym->name, left->ms.sym->name);
> +}

why do we need just string comparison for sort?

> +
> static int _hist_entry__sym_snprintf(struct map *map, struct symbol *sym,
> u64 ip, char level, char *bf, size_t size,
> unsigned int width)
> @@ -255,6 +271,7 @@ static int hist_entry__sym_snprintf(struct hist_entry *he, char *bf,
> struct sort_entry sort_sym = {
> .se_header = "Symbol",
> .se_cmp = sort__sym_cmp,
> + .se_sort = sort__sym_sort,
> .se_snprintf = hist_entry__sym_snprintf,
> .se_width_idx = HISTC_SYMBOL,

so when we insert entries into hists we use se_cmp to group them
via hist_entry__cmp

the we sort this hists based on output and use se_sort to group
them via __hists__insert_output_entry

why can't we use just cmp?

jirka


\
 
 \ /
  Last update: 2014-05-15 16:21    [W:0.152 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site