diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-03-02 07:58:00 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-03-03 09:10:39 -0500 |
commit | 9b240637eb9b9677a9e9bc2dc568f5e0811e04d6 (patch) | |
tree | 4fbba141a383ab74cd6c5d4dd2e9439b0a1f77fa | |
parent | a66673a07e260807f570db8f08a9c1207932c665 (diff) |
perf test: Fix hists related entries
That got broken by d3a72fd8187b ("perf report: Fix indentation of
dynamic entries in hierarchy"), by using the evlist in setup_sorting()
without checking if it is NULL, as done in some 'perf test' entries:
$ find tools/ -name "*.c" | xargs grep 'setup_sorting(NULL);'
tools/perf/tests/hists_output.c: setup_sorting(NULL);
tools/perf/tests/hists_output.c: setup_sorting(NULL);
tools/perf/tests/hists_output.c: setup_sorting(NULL);
tools/perf/tests/hists_output.c: setup_sorting(NULL);
tools/perf/tests/hists_output.c: setup_sorting(NULL);
tools/perf/tests/hists_cumulate.c: setup_sorting(NULL);
tools/perf/tests/hists_cumulate.c: setup_sorting(NULL);
tools/perf/tests/hists_cumulate.c: setup_sorting(NULL);
tools/perf/tests/hists_cumulate.c: setup_sorting(NULL);
$
Fix it.
Before:
[root@jouet ~]# perf test
<SNIP>
15: Test matching and linking multiple hists : FAILED!
16: Try 'import perf' in python, checking link problems : Ok
17: Test breakpoint overflow signal handler : Ok
18: Test breakpoint overflow sampling : Ok
19: Test number of exit event of a simple workload : Ok
20: Test software clock events have valid period values : Ok
21: Test object code reading : Ok
22: Test sample parsing : Ok
23: Test using a dummy software event to keep tracking : Ok
24: Test parsing with no sample_id_all bit set : Ok
25: Test filtering hist entries : FAILED!
26: Test mmap thread lookup : Ok
27: Test thread mg sharing : Ok
28: Test output sorting of hist entries : FAILED!
29: Test cumulation of child hist entries : FAILED!
<SNIP>
After the patch the above failed tests complete successfully.
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: d3a72fd8187b ("perf report: Fix indentation of dynamic entries in hierarchy")
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/util/sort.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 5888bfe9a193..4380a2858802 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c | |||
@@ -2635,25 +2635,14 @@ out: | |||
2635 | return ret; | 2635 | return ret; |
2636 | } | 2636 | } |
2637 | 2637 | ||
2638 | int setup_sorting(struct perf_evlist *evlist) | 2638 | static void evlist__set_hists_nr_sort_keys(struct perf_evlist *evlist) |
2639 | { | 2639 | { |
2640 | int err; | ||
2641 | struct hists *hists; | ||
2642 | struct perf_evsel *evsel; | 2640 | struct perf_evsel *evsel; |
2643 | struct perf_hpp_fmt *fmt; | ||
2644 | |||
2645 | err = __setup_sorting(evlist); | ||
2646 | if (err < 0) | ||
2647 | return err; | ||
2648 | |||
2649 | if (parent_pattern != default_parent_pattern) { | ||
2650 | err = sort_dimension__add("parent", evlist); | ||
2651 | if (err < 0) | ||
2652 | return err; | ||
2653 | } | ||
2654 | 2641 | ||
2655 | evlist__for_each(evlist, evsel) { | 2642 | evlist__for_each(evlist, evsel) { |
2656 | hists = evsel__hists(evsel); | 2643 | struct perf_hpp_fmt *fmt; |
2644 | struct hists *hists = evsel__hists(evsel); | ||
2645 | |||
2657 | hists->nr_sort_keys = perf_hpp_list.nr_sort_keys; | 2646 | hists->nr_sort_keys = perf_hpp_list.nr_sort_keys; |
2658 | 2647 | ||
2659 | /* | 2648 | /* |
@@ -2667,6 +2656,24 @@ int setup_sorting(struct perf_evlist *evlist) | |||
2667 | hists->nr_sort_keys--; | 2656 | hists->nr_sort_keys--; |
2668 | } | 2657 | } |
2669 | } | 2658 | } |
2659 | } | ||
2660 | |||
2661 | int setup_sorting(struct perf_evlist *evlist) | ||
2662 | { | ||
2663 | int err; | ||
2664 | |||
2665 | err = __setup_sorting(evlist); | ||
2666 | if (err < 0) | ||
2667 | return err; | ||
2668 | |||
2669 | if (parent_pattern != default_parent_pattern) { | ||
2670 | err = sort_dimension__add("parent", evlist); | ||
2671 | if (err < 0) | ||
2672 | return err; | ||
2673 | } | ||
2674 | |||
2675 | if (evlist != NULL) | ||
2676 | evlist__set_hists_nr_sort_keys(evlist); | ||
2670 | 2677 | ||
2671 | reset_dimensions(); | 2678 | reset_dimensions(); |
2672 | 2679 | ||