diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2013-04-03 08:26:19 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-05-28 09:23:54 -0400 |
commit | 08e71542fd0f4a0e30b4e3794329d63ae891e0c0 (patch) | |
tree | 4d065cbda95407a6ef7b8dddd44af0e3a1f0c220 /tools/perf/util | |
parent | afab87b91f3f331d55664172dad8e476e6ffca9d (diff) |
perf sort: Consolidate sort_entry__setup_elide()
The same code was duplicate to places, factor them out to common
sort__setup_elide().
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1364991979-3008-11-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/sort.c | 45 | ||||
-rw-r--r-- | tools/perf/util/sort.h | 3 |
2 files changed, 44 insertions, 4 deletions
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 1dbf16949250..701ab1d84894 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #include "sort.h" | 1 | #include "sort.h" |
2 | #include "hist.h" | 2 | #include "hist.h" |
3 | #include "symbol.h" | ||
3 | 4 | ||
4 | regex_t parent_regex; | 5 | regex_t parent_regex; |
5 | const char default_parent_pattern[] = "^sys_|^do_page_fault"; | 6 | const char default_parent_pattern[] = "^sys_|^do_page_fault"; |
@@ -1009,8 +1010,9 @@ int setup_sorting(void) | |||
1009 | return ret; | 1010 | return ret; |
1010 | } | 1011 | } |
1011 | 1012 | ||
1012 | void sort_entry__setup_elide(struct sort_entry *self, struct strlist *list, | 1013 | static void sort_entry__setup_elide(struct sort_entry *self, |
1013 | const char *list_name, FILE *fp) | 1014 | struct strlist *list, |
1015 | const char *list_name, FILE *fp) | ||
1014 | { | 1016 | { |
1015 | if (list && strlist__nr_entries(list) == 1) { | 1017 | if (list && strlist__nr_entries(list) == 1) { |
1016 | if (fp != NULL) | 1018 | if (fp != NULL) |
@@ -1019,3 +1021,42 @@ void sort_entry__setup_elide(struct sort_entry *self, struct strlist *list, | |||
1019 | self->elide = true; | 1021 | self->elide = true; |
1020 | } | 1022 | } |
1021 | } | 1023 | } |
1024 | |||
1025 | void sort__setup_elide(FILE *output) | ||
1026 | { | ||
1027 | sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, | ||
1028 | "dso", output); | ||
1029 | sort_entry__setup_elide(&sort_comm, symbol_conf.comm_list, | ||
1030 | "comm", output); | ||
1031 | sort_entry__setup_elide(&sort_sym, symbol_conf.sym_list, | ||
1032 | "symbol", output); | ||
1033 | |||
1034 | if (sort__mode == SORT_MODE__BRANCH) { | ||
1035 | sort_entry__setup_elide(&sort_dso_from, | ||
1036 | symbol_conf.dso_from_list, | ||
1037 | "dso_from", output); | ||
1038 | sort_entry__setup_elide(&sort_dso_to, | ||
1039 | symbol_conf.dso_to_list, | ||
1040 | "dso_to", output); | ||
1041 | sort_entry__setup_elide(&sort_sym_from, | ||
1042 | symbol_conf.sym_from_list, | ||
1043 | "sym_from", output); | ||
1044 | sort_entry__setup_elide(&sort_sym_to, | ||
1045 | symbol_conf.sym_to_list, | ||
1046 | "sym_to", output); | ||
1047 | } else if (sort__mode == SORT_MODE__MEMORY) { | ||
1048 | sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, | ||
1049 | "symbol_daddr", output); | ||
1050 | sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, | ||
1051 | "dso_daddr", output); | ||
1052 | sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, | ||
1053 | "mem", output); | ||
1054 | sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, | ||
1055 | "local_weight", output); | ||
1056 | sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, | ||
1057 | "tlb", output); | ||
1058 | sort_entry__setup_elide(&sort_dso, symbol_conf.dso_list, | ||
1059 | "snoop", output); | ||
1060 | } | ||
1061 | |||
1062 | } | ||
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h index 0232d476da87..51f1b5a854e7 100644 --- a/tools/perf/util/sort.h +++ b/tools/perf/util/sort.h | |||
@@ -181,7 +181,6 @@ extern struct list_head hist_entry__sort_list; | |||
181 | 181 | ||
182 | int setup_sorting(void); | 182 | int setup_sorting(void); |
183 | extern int sort_dimension__add(const char *); | 183 | extern int sort_dimension__add(const char *); |
184 | void sort_entry__setup_elide(struct sort_entry *self, struct strlist *list, | 184 | void sort__setup_elide(FILE *fp); |
185 | const char *list_name, FILE *fp); | ||
186 | 185 | ||
187 | #endif /* __PERF_SORT_H */ | 186 | #endif /* __PERF_SORT_H */ |