perf hists: Count number of sort keys
authorNamhyung Kim <namhyung@kernel.org>
Wed, 24 Feb 2016 15:13:40 +0000 (00:13 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 24 Feb 2016 23:21:11 +0000 (20:21 -0300)
It'll be used for hierarchy output mode to indent entries properly.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1456326830-30456-9-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/ui/hist.c
tools/perf/util/hist.h

index 12223d791e9f3a6b888c201dec1680570f797b23..edbf854e8e1c22898b02d7fbe6f2a20a44b7f66c 100644 (file)
@@ -514,6 +514,9 @@ void perf_hpp_list__column_register(struct perf_hpp_list *list,
 void perf_hpp_list__register_sort_field(struct perf_hpp_list *list,
                                        struct perf_hpp_fmt *format)
 {
+       if (perf_hpp__is_sort_entry(format) || perf_hpp__is_dynamic_entry(format))
+               list->nr_sort_keys++;
+
        list_add_tail(&format->sort_list, &list->sorts);
 }
 
index 480d2eb26001fd641159ab24df6a3ea44739dc4b..d08e4f36f1935e9d99290785e14e5ede179fcb5e 100644 (file)
@@ -237,6 +237,7 @@ struct perf_hpp_fmt {
 struct perf_hpp_list {
        struct list_head fields;
        struct list_head sorts;
+       int nr_sort_keys;
 };
 
 extern struct perf_hpp_list perf_hpp_list;