Re: [PATCH 5/9] perf sort: Separate out memory-specific sort keys

From: Jiri Olsa
Date: Mon Apr 01 2013 - 16:30:07 EST


On Mon, Apr 01, 2013 at 08:35:21PM +0900, Namhyung Kim wrote:

SNIP

> +
> int sort_dimension__add(const char *tok)
> {
> unsigned int i;
> @@ -964,6 +971,33 @@ int sort_dimension__add(const char *tok)
> return 0;
> }
>
> + for (i = 0; i < ARRAY_SIZE(memory_sort_dimensions); i++) {
> + struct sort_dimension *sd = &memory_sort_dimensions[i];
> +
> + if (strncasecmp(tok, sd->name, strlen(tok)))
> + continue;
> +
> + if (sort__mode != SORT_MODE__MEMORY)
> + return -EINVAL;
> +
> + if (sd->entry == &sort_mem_daddr_sym)
> + sort__has_sym = 1;
> +
> + if (sd->taken)
> + return 0;
> +
> + if (sd->entry->se_collapse)
> + sort__need_collapse = 1;
> +
> + if (list_empty(&hist_entry__sort_list))
> + sort__first_dimension = i + __SORT_MEMORY_MODE;
> +
> + list_add_tail(&sd->entry->list, &hist_entry__sort_list);
> + sd->taken = 1;
> +
> + return 0;

nice idea, I wonder some of the above code be put into function
and used also in previous loop, no big deal though

jirka
--
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/