duplicate cache misses counter labels with perf-stat
When I do this with perf 3.5.2,
perf stat -x, -e
L1-dcache-loads,L1-dcache-load-misses,L1-dcache-stores,L1-dcache-store-misses ls
I'm seeing this output from perf:
697171,L1-dcache-loads
28012,L1-dcache-misses
455691,L1-dcache-stores
11791,L1-dcache-misses
So, I'm getting two results labeled "L1-dcache-misses" (with different values!) and none labeled "L1-dcache-store-misses". It looks to me like one of the "L1-dcache-misses" is mislabeled.
There appears to be a general problem with all of the *-misses counters, as a similar thing happens with, e.g., LLC-load-misses and LLC-store-missses, and all of the others I've checked.
Is this a bug, or am I misunderstanding how perf-stat is supposed to work?
PATCH 1/1 perf tools: Fix cache event name generation
Quoted 20 lines · Joel Uckelman
When I do this with perf 3.5.2,
perf stat -x, -e
L1-dcache-loads,L1-dcache-load-misses,L1-dcache-stores,L1-dcache-store-misses lsI'm seeing this output from perf:
697171,L1-dcache-loads
28012,L1-dcache-misses
455691,L1-dcache-stores
11791,L1-dcache-misses
So, I'm getting two results labeled "L1-dcache-misses" (with different values!) and none labeled "L1-dcache-store-misses". It looks to me like one of the "L1-dcache-misses" is mislabeled.
Quoted 5 lines
There appears to be a general problem with all of the *-misses counters, as a similar thing happens with, e.g., LLC-load-misses and LLC-store-missses, and all of the others I've checked.
Is this a bug, or am I misunderstanding how perf-stat is supposed to work?
bug ;) please try attached patch
thanks,
jirka
---
If the event name is specified with all 3 components, the last one overwrites the previous one during the name composing within the parse_events_add_cache function.
Fixing this by properly adjusting the string index.
--- tools/perf/util/parse-events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/parse-events.c +1 -1
@@ -308,7 +308,7 @@ int parse_events_add_cache(struct list_head **list, int *idx,for (i =0 ; (i <2 ) && (op_result[i]); i++) {char *str = op_result[i]; -snprintf (name + n,MAX_NAME_LEN - n,"-%s\n" , str); + n +=snprintf (name + n,MAX_NAME_LEN - n,"-%s" , str);if (cache_op ==-1 ) { cache_op = parse_aliases(str, perf_evsel__hw_cache_op,
Signature · 1 line
1.7.11.4