diff options
-rw-r--r-- | tools/perf/util/parse-events.c | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 7939a21130d2..430f06083201 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -71,23 +71,23 @@ static char *sw_event_names[] = { | |||
71 | #define MAX_ALIASES 8 | 71 | #define MAX_ALIASES 8 |
72 | 72 | ||
73 | static char *hw_cache[][MAX_ALIASES] = { | 73 | static char *hw_cache[][MAX_ALIASES] = { |
74 | { "L1-data", "l1-d", "l1d" }, | 74 | { "L1-d$", "l1-d", "L1-data", }, |
75 | { "L1-instruction", "l1-i", "l1i" }, | 75 | { "L1-i$", "l1-i", "L1-instruction", }, |
76 | { "L2", "l2" }, | 76 | { "LLC", "L2" }, |
77 | { "Data-TLB", "dtlb", "d-tlb" }, | 77 | { "dTLB", "d-tlb", "Data-TLB", }, |
78 | { "Instruction-TLB", "itlb", "i-tlb" }, | 78 | { "iTLB", "i-tlb", "Instruction-TLB", }, |
79 | { "Branch", "bpu" , "btb", "bpc" }, | 79 | { "branch", "branches", "bpu", "btb", "bpc", }, |
80 | }; | 80 | }; |
81 | 81 | ||
82 | static char *hw_cache_op[][MAX_ALIASES] = { | 82 | static char *hw_cache_op[][MAX_ALIASES] = { |
83 | { "Load", "read" }, | 83 | { "load", "loads", "read", }, |
84 | { "Store", "write" }, | 84 | { "store", "stores", "write", }, |
85 | { "Prefetch", "speculative-read", "speculative-load" }, | 85 | { "prefetch", "prefetches", "speculative-read", "speculative-load", }, |
86 | }; | 86 | }; |
87 | 87 | ||
88 | static char *hw_cache_result[][MAX_ALIASES] = { | 88 | static char *hw_cache_result[][MAX_ALIASES] = { |
89 | { "Reference", "ops", "access" }, | 89 | { "refs", "Reference", "ops", "access", }, |
90 | { "Miss" }, | 90 | { "misses", "miss", }, |
91 | }; | 91 | }; |
92 | 92 | ||
93 | #define C(x) PERF_COUNT_HW_CACHE_##x | 93 | #define C(x) PERF_COUNT_HW_CACHE_##x |
@@ -118,6 +118,22 @@ static int is_cache_op_valid(u8 cache_type, u8 cache_op) | |||
118 | return 0; /* invalid */ | 118 | return 0; /* invalid */ |
119 | } | 119 | } |
120 | 120 | ||
121 | static char *event_cache_name(u8 cache_type, u8 cache_op, u8 cache_result) | ||
122 | { | ||
123 | static char name[50]; | ||
124 | |||
125 | if (cache_result) { | ||
126 | sprintf(name, "%s-%s-%s", hw_cache[cache_type][0], | ||
127 | hw_cache_op[cache_op][0], | ||
128 | hw_cache_result[cache_result][0]); | ||
129 | } else { | ||
130 | sprintf(name, "%s-%s", hw_cache[cache_type][0], | ||
131 | hw_cache_op[cache_op][1]); | ||
132 | } | ||
133 | |||
134 | return name; | ||
135 | } | ||
136 | |||
121 | char *event_name(int counter) | 137 | char *event_name(int counter) |
122 | { | 138 | { |
123 | u64 config = attrs[counter].config; | 139 | u64 config = attrs[counter].config; |
@@ -137,7 +153,6 @@ char *event_name(int counter) | |||
137 | 153 | ||
138 | case PERF_TYPE_HW_CACHE: { | 154 | case PERF_TYPE_HW_CACHE: { |
139 | u8 cache_type, cache_op, cache_result; | 155 | u8 cache_type, cache_op, cache_result; |
140 | static char name[100]; | ||
141 | 156 | ||
142 | cache_type = (config >> 0) & 0xff; | 157 | cache_type = (config >> 0) & 0xff; |
143 | if (cache_type > PERF_COUNT_HW_CACHE_MAX) | 158 | if (cache_type > PERF_COUNT_HW_CACHE_MAX) |
@@ -153,12 +168,8 @@ char *event_name(int counter) | |||
153 | 168 | ||
154 | if (!is_cache_op_valid(cache_type, cache_op)) | 169 | if (!is_cache_op_valid(cache_type, cache_op)) |
155 | return "invalid-cache"; | 170 | return "invalid-cache"; |
156 | sprintf(name, "%s-Cache-%s-%ses", | ||
157 | hw_cache[cache_type][0], | ||
158 | hw_cache_op[cache_op][0], | ||
159 | hw_cache_result[cache_result][0]); | ||
160 | 171 | ||
161 | return name; | 172 | return event_cache_name(cache_type, cache_op, cache_result); |
162 | } | 173 | } |
163 | 174 | ||
164 | case PERF_TYPE_SOFTWARE: | 175 | case PERF_TYPE_SOFTWARE: |