Commit 1f41873c authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf tests attr: Add optional term

Some of the stat events are quite rare to find on common machines (like
front end cycles).

Adding an 'optional' term to mark such events in attr tests. Event
marked as optional will not fail the test case if it's not found in
results.
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20170703145030.12903-15-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent b78e92e6
...@@ -105,6 +105,11 @@ class Event(dict): ...@@ -105,6 +105,11 @@ class Event(dict):
return False return False
return True return True
def optional(self):
if self.has_key('optional') and self['optional'] == '1':
return True
return False
def diff(self, other): def diff(self, other):
for t in Event.terms: for t in Event.terms:
if not self.has_key(t) or not other.has_key(t): if not self.has_key(t) or not other.has_key(t):
...@@ -244,9 +249,12 @@ class Test(object): ...@@ -244,9 +249,12 @@ class Test(object):
log.debug(" match: [%s] matches %s" % (exp_name, str(exp_list))) log.debug(" match: [%s] matches %s" % (exp_name, str(exp_list)))
# we did not any matching event - fail # we did not any matching event - fail
if (not exp_list): if not exp_list:
exp_event.diff(res_event) if exp_event.optional():
raise Fail(self, 'match failure'); log.debug(" %s does not match, but is optional" % exp_name)
else:
exp_event.diff(res_event)
raise Fail(self, 'match failure');
match[exp_name] = exp_list match[exp_name] = exp_list
......
...@@ -38,12 +38,14 @@ config=0 ...@@ -38,12 +38,14 @@ config=0
fd=6 fd=6
type=0 type=0
config=7 config=7
optional=1
# PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND # PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND
[event7:base-stat] [event7:base-stat]
fd=7 fd=7
type=0 type=0
config=8 config=8
optional=1
# PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS # PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS
[event8:base-stat] [event8:base-stat]
......
...@@ -39,12 +39,14 @@ config=0 ...@@ -39,12 +39,14 @@ config=0
fd=6 fd=6
type=0 type=0
config=7 config=7
optional=1
# PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND # PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND
[event7:base-stat] [event7:base-stat]
fd=7 fd=7
type=0 type=0
config=8 config=8
optional=1
# PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS # PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS
[event8:base-stat] [event8:base-stat]
......
...@@ -39,12 +39,14 @@ config=0 ...@@ -39,12 +39,14 @@ config=0
fd=6 fd=6
type=0 type=0
config=7 config=7
optional=1
# PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND # PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND
[event7:base-stat] [event7:base-stat]
fd=7 fd=7
type=0 type=0
config=8 config=8
optional=1
# PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS # PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS
[event8:base-stat] [event8:base-stat]
...@@ -108,6 +110,7 @@ config=65538 ...@@ -108,6 +110,7 @@ config=65538
fd=15 fd=15
type=3 type=3
config=1 config=1
optional=1
# PERF_TYPE_HW_CACHE, # PERF_TYPE_HW_CACHE,
# PERF_COUNT_HW_CACHE_L1I << 0 | # PERF_COUNT_HW_CACHE_L1I << 0 |
......
...@@ -39,12 +39,14 @@ config=0 ...@@ -39,12 +39,14 @@ config=0
fd=6 fd=6
type=0 type=0
config=7 config=7
optional=1
# PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND # PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND
[event7:base-stat] [event7:base-stat]
fd=7 fd=7
type=0 type=0
config=8 config=8
optional=1
# PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS # PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS
[event8:base-stat] [event8:base-stat]
...@@ -108,6 +110,7 @@ config=65538 ...@@ -108,6 +110,7 @@ config=65538
fd=15 fd=15
type=3 type=3
config=1 config=1
optional=1
# PERF_TYPE_HW_CACHE, # PERF_TYPE_HW_CACHE,
# PERF_COUNT_HW_CACHE_L1I << 0 | # PERF_COUNT_HW_CACHE_L1I << 0 |
...@@ -162,6 +165,7 @@ config=65540 ...@@ -162,6 +165,7 @@ config=65540
fd=21 fd=21
type=3 type=3
config=512 config=512
optional=1
# PERF_TYPE_HW_CACHE, # PERF_TYPE_HW_CACHE,
# PERF_COUNT_HW_CACHE_L1D << 0 | # PERF_COUNT_HW_CACHE_L1D << 0 |
...@@ -171,3 +175,4 @@ config=512 ...@@ -171,3 +175,4 @@ config=512
fd=22 fd=22
type=3 type=3
config=66048 config=66048
optional=1
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment