Re: [PATCH 09/10] perf tools: Make 'trace' sort key default for tracepoint events

From: Jiri Olsa
Date: Tue Dec 22 2015 - 02:29:54 EST


On Mon, Dec 21, 2015 at 11:26:52PM +0900, Namhyung Kim wrote:
> When an evlist contains tracepoint events only, use 'trace' sort key as
> default. This will make users more convenient to see trace result.
>
> Suggested-by: Jiri Olsa <jolsa@xxxxxxxxxx>
> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
> Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
> ---
> tools/perf/util/sort.c | 22 +++++++++++++++++-----
> 1 file changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
> index f38a0577967a..43cb9b638718 100644
> --- a/tools/perf/util/sort.c
> +++ b/tools/perf/util/sort.c
> @@ -2067,7 +2067,7 @@ static int sort_dimension__add(const char *tok,
> return -ESRCH;
> }
>
> -static const char *get_default_sort_order(void)
> +static const char *get_default_sort_order(struct perf_evlist *evlist)
> {
> const char *default_sort_orders[] = {
> default_sort_order,
> @@ -2076,13 +2076,25 @@ static const char *get_default_sort_order(void)
> default_top_sort_order,
> default_diff_sort_order,
> };
> + bool use_trace = true;
> + struct perf_evsel *evsel;
>
> BUG_ON(sort__mode >= ARRAY_SIZE(default_sort_orders));
>
> + evlist__for_each(evlist, evsel) {
> + if (evsel->attr.type != PERF_TYPE_TRACEPOINT) {
> + use_trace = false;
> + break;
> + }
> + }
> +
> + if (use_trace)
> + return "trace";

I wonder it'd be little 'nicer' to keep the current style
for sort orders for tracepoint even thought it has just single
column.. like adding:
- default_tracepoint_sort_order = "trace"
- SORT_MODE__TRACEPOINT

jirka

> +
> return default_sort_orders[sort__mode];
> }

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