diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2013-04-03 08:26:11 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-05-28 09:23:54 -0400 |
commit | afab87b91f3f331d55664172dad8e476e6ffca9d (patch) | |
tree | a533ae46a92da08601a8792a7be3bbee91f168a2 /tools/perf | |
parent | 2f532d09fa3a7eaf7cf1c23de9767eab8c8c0e7e (diff) |
perf sort: Separate out memory-specific sort keys
Since they're used only for perf mem, separate out them to a different
dimension so that normal user cannot access them by any chance.
For global/local weights, I'm not entirely sure to place them into the
memory dimension. But it's the only user at this time.
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-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/builtin-report.c | 2 | ||||
-rw-r--r-- | tools/perf/util/sort.c | 39 | ||||
-rw-r--r-- | tools/perf/util/sort.h | 19 |
3 files changed, 44 insertions, 16 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index c877982a64d3..669405c9b8a2 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -871,6 +871,8 @@ repeat: | |||
871 | fprintf(stderr, "branch and mem mode incompatible\n"); | 871 | fprintf(stderr, "branch and mem mode incompatible\n"); |
872 | goto error; | 872 | goto error; |
873 | } | 873 | } |
874 | sort__mode = SORT_MODE__MEMORY; | ||
875 | |||
874 | /* | 876 | /* |
875 | * if no sort_order is provided, then specify | 877 | * if no sort_order is provided, then specify |
876 | * branch-mode specific order | 878 | * branch-mode specific order |
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index a997955085eb..1dbf16949250 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c | |||
@@ -871,14 +871,6 @@ static struct sort_dimension common_sort_dimensions[] = { | |||
871 | DIM(SORT_PARENT, "parent", sort_parent), | 871 | DIM(SORT_PARENT, "parent", sort_parent), |
872 | DIM(SORT_CPU, "cpu", sort_cpu), | 872 | DIM(SORT_CPU, "cpu", sort_cpu), |
873 | DIM(SORT_SRCLINE, "srcline", sort_srcline), | 873 | DIM(SORT_SRCLINE, "srcline", sort_srcline), |
874 | DIM(SORT_LOCAL_WEIGHT, "local_weight", sort_local_weight), | ||
875 | DIM(SORT_GLOBAL_WEIGHT, "weight", sort_global_weight), | ||
876 | DIM(SORT_MEM_DADDR_SYMBOL, "symbol_daddr", sort_mem_daddr_sym), | ||
877 | DIM(SORT_MEM_DADDR_DSO, "dso_daddr", sort_mem_daddr_dso), | ||
878 | DIM(SORT_MEM_LOCKED, "locked", sort_mem_locked), | ||
879 | DIM(SORT_MEM_TLB, "tlb", sort_mem_tlb), | ||
880 | DIM(SORT_MEM_LVL, "mem", sort_mem_lvl), | ||
881 | DIM(SORT_MEM_SNOOP, "snoop", sort_mem_snoop), | ||
882 | }; | 874 | }; |
883 | 875 | ||
884 | #undef DIM | 876 | #undef DIM |
@@ -895,6 +887,21 @@ static struct sort_dimension bstack_sort_dimensions[] = { | |||
895 | 887 | ||
896 | #undef DIM | 888 | #undef DIM |
897 | 889 | ||
890 | #define DIM(d, n, func) [d - __SORT_MEMORY_MODE] = { .name = n, .entry = &(func) } | ||
891 | |||
892 | static struct sort_dimension memory_sort_dimensions[] = { | ||
893 | DIM(SORT_LOCAL_WEIGHT, "local_weight", sort_local_weight), | ||
894 | DIM(SORT_GLOBAL_WEIGHT, "weight", sort_global_weight), | ||
895 | DIM(SORT_MEM_DADDR_SYMBOL, "symbol_daddr", sort_mem_daddr_sym), | ||
896 | DIM(SORT_MEM_DADDR_DSO, "dso_daddr", sort_mem_daddr_dso), | ||
897 | DIM(SORT_MEM_LOCKED, "locked", sort_mem_locked), | ||
898 | DIM(SORT_MEM_TLB, "tlb", sort_mem_tlb), | ||
899 | DIM(SORT_MEM_LVL, "mem", sort_mem_lvl), | ||
900 | DIM(SORT_MEM_SNOOP, "snoop", sort_mem_snoop), | ||
901 | }; | ||
902 | |||
903 | #undef DIM | ||
904 | |||
898 | static void __sort_dimension__add(struct sort_dimension *sd, enum sort_type idx) | 905 | static void __sort_dimension__add(struct sort_dimension *sd, enum sort_type idx) |
899 | { | 906 | { |
900 | if (sd->taken) | 907 | if (sd->taken) |
@@ -957,6 +964,22 @@ int sort_dimension__add(const char *tok) | |||
957 | return 0; | 964 | return 0; |
958 | } | 965 | } |
959 | 966 | ||
967 | for (i = 0; i < ARRAY_SIZE(memory_sort_dimensions); i++) { | ||
968 | struct sort_dimension *sd = &memory_sort_dimensions[i]; | ||
969 | |||
970 | if (strncasecmp(tok, sd->name, strlen(tok))) | ||
971 | continue; | ||
972 | |||
973 | if (sort__mode != SORT_MODE__MEMORY) | ||
974 | return -EINVAL; | ||
975 | |||
976 | if (sd->entry == &sort_mem_daddr_sym) | ||
977 | sort__has_sym = 1; | ||
978 | |||
979 | __sort_dimension__add(sd, i + __SORT_MEMORY_MODE); | ||
980 | return 0; | ||
981 | } | ||
982 | |||
960 | return -ESRCH; | 983 | return -ESRCH; |
961 | } | 984 | } |
962 | 985 | ||
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h index 39ff4b86ae84..0232d476da87 100644 --- a/tools/perf/util/sort.h +++ b/tools/perf/util/sort.h | |||
@@ -138,14 +138,6 @@ enum sort_type { | |||
138 | SORT_PARENT, | 138 | SORT_PARENT, |
139 | SORT_CPU, | 139 | SORT_CPU, |
140 | SORT_SRCLINE, | 140 | SORT_SRCLINE, |
141 | SORT_LOCAL_WEIGHT, | ||
142 | SORT_GLOBAL_WEIGHT, | ||
143 | SORT_MEM_DADDR_SYMBOL, | ||
144 | SORT_MEM_DADDR_DSO, | ||
145 | SORT_MEM_LOCKED, | ||
146 | SORT_MEM_TLB, | ||
147 | SORT_MEM_LVL, | ||
148 | SORT_MEM_SNOOP, | ||
149 | 141 | ||
150 | /* branch stack specific sort keys */ | 142 | /* branch stack specific sort keys */ |
151 | __SORT_BRANCH_STACK, | 143 | __SORT_BRANCH_STACK, |
@@ -154,6 +146,17 @@ enum sort_type { | |||
154 | SORT_SYM_FROM, | 146 | SORT_SYM_FROM, |
155 | SORT_SYM_TO, | 147 | SORT_SYM_TO, |
156 | SORT_MISPREDICT, | 148 | SORT_MISPREDICT, |
149 | |||
150 | /* memory mode specific sort keys */ | ||
151 | __SORT_MEMORY_MODE, | ||
152 | SORT_LOCAL_WEIGHT = __SORT_MEMORY_MODE, | ||
153 | SORT_GLOBAL_WEIGHT, | ||
154 | SORT_MEM_DADDR_SYMBOL, | ||
155 | SORT_MEM_DADDR_DSO, | ||
156 | SORT_MEM_LOCKED, | ||
157 | SORT_MEM_TLB, | ||
158 | SORT_MEM_LVL, | ||
159 | SORT_MEM_SNOOP, | ||
157 | }; | 160 | }; |
158 | 161 | ||
159 | /* | 162 | /* |