diff options
author | Vineet Gupta <vgupta@synopsys.com> | 2015-04-15 10:14:07 -0400 |
---|---|---|
committer | Vineet Gupta <vgupta@synopsys.com> | 2015-04-20 08:57:30 -0400 |
commit | bde80c237e49983e2b26dfa9925325a070b71de7 (patch) | |
tree | 8b9f0ff0b9e0553665dfab6e35e14afc7212387b /arch/arc/kernel | |
parent | 03c94fcf954d6bc5e23460e200d23a2c0fe5cd2e (diff) |
ARC: perf: Add some comments/debug stuff
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc/kernel')
-rw-r--r-- | arch/arc/kernel/perf_event.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c index 64261c2711b1..181baeed4495 100644 --- a/arch/arc/kernel/perf_event.c +++ b/arch/arc/kernel/perf_event.c | |||
@@ -90,6 +90,10 @@ static int arc_pmu_cache_event(u64 config) | |||
90 | if (ret == CACHE_OP_UNSUPPORTED) | 90 | if (ret == CACHE_OP_UNSUPPORTED) |
91 | return -ENOENT; | 91 | return -ENOENT; |
92 | 92 | ||
93 | pr_debug("init cache event: type/op/result %d/%d/%d with h/w %d \'%s\'\n", | ||
94 | cache_type, cache_op, cache_result, ret, | ||
95 | arc_pmu_ev_hw_map[ret]); | ||
96 | |||
93 | return ret; | 97 | return ret; |
94 | } | 98 | } |
95 | 99 | ||
@@ -106,8 +110,9 @@ static int arc_pmu_event_init(struct perf_event *event) | |||
106 | if (arc_pmu->ev_hw_idx[event->attr.config] < 0) | 110 | if (arc_pmu->ev_hw_idx[event->attr.config] < 0) |
107 | return -ENOENT; | 111 | return -ENOENT; |
108 | hwc->config = arc_pmu->ev_hw_idx[event->attr.config]; | 112 | hwc->config = arc_pmu->ev_hw_idx[event->attr.config]; |
109 | pr_debug("initializing event %d with cfg %d\n", | 113 | pr_debug("init event %d with h/w %d \'%s\'\n", |
110 | (int) event->attr.config, (int) hwc->config); | 114 | (int) event->attr.config, (int) hwc->config, |
115 | arc_pmu_ev_hw_map[event->attr.config]); | ||
111 | return 0; | 116 | return 0; |
112 | case PERF_TYPE_HW_CACHE: | 117 | case PERF_TYPE_HW_CACHE: |
113 | ret = arc_pmu_cache_event(event->attr.config); | 118 | ret = arc_pmu_cache_event(event->attr.config); |
@@ -260,19 +265,22 @@ static int arc_pmu_device_probe(struct platform_device *pdev) | |||
260 | arc_pmu->n_counters, arc_pmu->counter_size, cc_bcr.c); | 265 | arc_pmu->n_counters, arc_pmu->counter_size, cc_bcr.c); |
261 | 266 | ||
262 | cc_name.str[8] = 0; | 267 | cc_name.str[8] = 0; |
263 | for (i = 0; i < PERF_COUNT_HW_MAX; i++) | 268 | for (i = 0; i < PERF_COUNT_ARC_HW_MAX; i++) |
264 | arc_pmu->ev_hw_idx[i] = -1; | 269 | arc_pmu->ev_hw_idx[i] = -1; |
265 | 270 | ||
271 | /* loop thru all available h/w condition indexes */ | ||
266 | for (j = 0; j < cc_bcr.c; j++) { | 272 | for (j = 0; j < cc_bcr.c; j++) { |
267 | write_aux_reg(ARC_REG_CC_INDEX, j); | 273 | write_aux_reg(ARC_REG_CC_INDEX, j); |
268 | cc_name.indiv.word0 = read_aux_reg(ARC_REG_CC_NAME0); | 274 | cc_name.indiv.word0 = read_aux_reg(ARC_REG_CC_NAME0); |
269 | cc_name.indiv.word1 = read_aux_reg(ARC_REG_CC_NAME1); | 275 | cc_name.indiv.word1 = read_aux_reg(ARC_REG_CC_NAME1); |
276 | |||
277 | /* See if it has been mapped to a perf event_id */ | ||
270 | for (i = 0; i < ARRAY_SIZE(arc_pmu_ev_hw_map); i++) { | 278 | for (i = 0; i < ARRAY_SIZE(arc_pmu_ev_hw_map); i++) { |
271 | if (arc_pmu_ev_hw_map[i] && | 279 | if (arc_pmu_ev_hw_map[i] && |
272 | !strcmp(arc_pmu_ev_hw_map[i], cc_name.str) && | 280 | !strcmp(arc_pmu_ev_hw_map[i], cc_name.str) && |
273 | strlen(arc_pmu_ev_hw_map[i])) { | 281 | strlen(arc_pmu_ev_hw_map[i])) { |
274 | pr_debug("mapping %d to idx %d with name %s\n", | 282 | pr_debug("mapping perf event %2d to h/w event \'%8s\' (idx %d)\n", |
275 | i, j, cc_name.str); | 283 | i, cc_name.str, j); |
276 | arc_pmu->ev_hw_idx[i] = j; | 284 | arc_pmu->ev_hw_idx[i] = j; |
277 | } | 285 | } |
278 | } | 286 | } |