* [PATCH 0/4] perf tests: Fixies for perf_event_attr tests
@ 2012-11-05 15:49 Jiri Olsa
2012-11-05 15:49 ` [PATCH 1/4] perf tests: Add attr stat basic test Jiri Olsa
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Jiri Olsa @ 2012-11-05 15:49 UTC (permalink / raw)
To: linux-kernel
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
Paul Mackerras, Corey Ashford, Frederic Weisbecker
hi,
this patches address comments and some other small fixies.
It's based on current Arnaldo's perf/core.
Attached patches:
1/4 perf tests: Add attr stat basic test
2/4 perf tests: Factor attr tests WRITE_ASS macro
3/4 perf tests: Fix attr watermark field name typo
4/4 perf tests: Removing 'optional' field
Also available here:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/linux.git
perf/test7
thanks,
jirka
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
---
tools/perf/tests/attr.c | 87 +++++++++++++++++++++++++++++++++++++++++++--------------------------------------------
tools/perf/tests/attr.py | 31 +++++++++++++++++++------------
tools/perf/tests/attr/base-record | 2 +-
tools/perf/tests/attr/base-stat | 40 ++++++++++++++++++++++++++++++++++++++++
tools/perf/tests/attr/test-stat-basic | 6 ++++++
5 files changed, 109 insertions(+), 57 deletions(-)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/4] perf tests: Add attr stat basic test
2012-11-05 15:49 [PATCH 0/4] perf tests: Fixies for perf_event_attr tests Jiri Olsa
@ 2012-11-05 15:49 ` Jiri Olsa
2012-11-14 7:25 ` [tip:perf/core] perf tests: Add missing " tip-bot for Jiri Olsa
2012-11-05 15:49 ` [PATCH 2/4] perf tests: Factor attr tests WRITE_ASS macro Jiri Olsa
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Jiri Olsa @ 2012-11-05 15:49 UTC (permalink / raw)
To: linux-kernel
Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
Paul Mackerras, Corey Ashford, Frederic Weisbecker
Adding test to validate perf_event_attr data for command:
'stat -e cycles'
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
---
tools/perf/tests/attr/base-stat | 40 +++++++++++++++++++++++++++++++++++
tools/perf/tests/attr/test-stat-basic | 6 ++++++
2 files changed, 46 insertions(+)
create mode 100644 tools/perf/tests/attr/base-stat
create mode 100644 tools/perf/tests/attr/test-stat-basic
diff --git a/tools/perf/tests/attr/base-stat b/tools/perf/tests/attr/base-stat
new file mode 100644
index 0000000..6e1bb8e
--- /dev/null
+++ b/tools/perf/tests/attr/base-stat
@@ -0,0 +1,40 @@
+[event]
+fd=1
+group_fd=-1
+flags=0
+type=0
+size=96
+config=0
+sample_period=0
+sample_type=0
+read_format=3
+disabled=1
+inherit=1
+pinned=0
+exclusive=0
+exclude_user=0
+exclude_kernel=0
+exclude_hv=0
+exclude_idle=0
+mmap=0
+comm=0
+freq=0
+inherit_stat=0
+enable_on_exec=1
+task=0
+watermask=0
+precise_ip=0
+mmap_data=0
+sample_id_all=0
+exclude_host=0
+exclude_guest=1
+exclude_callchain_kernel=0
+exclude_callchain_user=0
+wakeup_events=0
+bp_type=0
+config1=0
+config2=0
+branch_sample_type=0
+sample_regs_user=0
+sample_stack_user=0
+optional=0
diff --git a/tools/perf/tests/attr/test-stat-basic b/tools/perf/tests/attr/test-stat-basic
new file mode 100644
index 0000000..74e1788
--- /dev/null
+++ b/tools/perf/tests/attr/test-stat-basic
@@ -0,0 +1,6 @@
+[config]
+command = stat
+args = -e cycles kill >/dev/null 2>&1
+ret = 1
+
+[event:base-stat]
--
1.7.11.7
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/4] perf tests: Factor attr tests WRITE_ASS macro
2012-11-05 15:49 [PATCH 0/4] perf tests: Fixies for perf_event_attr tests Jiri Olsa
2012-11-05 15:49 ` [PATCH 1/4] perf tests: Add attr stat basic test Jiri Olsa
@ 2012-11-05 15:49 ` Jiri Olsa
2012-11-14 7:26 ` [tip:perf/core] " tip-bot for Jiri Olsa
2012-11-05 15:49 ` [PATCH 3/4] perf tests: Fix attr watermark field name typo Jiri Olsa
2012-11-05 15:49 ` [PATCH 4/4] perf tests: Removing 'optional' field Jiri Olsa
3 siblings, 1 reply; 9+ messages in thread
From: Jiri Olsa @ 2012-11-05 15:49 UTC (permalink / raw)
To: linux-kernel
Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
Paul Mackerras, Corey Ashford, Frederic Weisbecker
Changing WRITE_ASS macro per Namhyung's comments, so the main
usage case takes only attr field name and format string.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
---
tools/perf/tests/attr.c | 89 +++++++++++++++++++++++++------------------------
1 file changed, 45 insertions(+), 44 deletions(-)
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index aacad82..1389d69 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -44,7 +44,7 @@ void test_attr__init(void)
#define BUFSIZE 1024
-#define WRITE_ASS(str, fmt, data) \
+#define __WRITE_ASS(str, fmt, data) \
do { \
char buf[BUFSIZE]; \
size_t size; \
@@ -58,6 +58,8 @@ do { \
\
} while (0)
+#define WRITE_ASS(field, fmt) __WRITE_ASS(field, fmt, attr->field)
+
static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,
int fd, int group_fd, unsigned long flags)
{
@@ -81,51 +83,50 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,
}
/* syscall arguments */
- WRITE_ASS(fd, "d", fd);
- WRITE_ASS(group_fd, "d", group_fd);
- WRITE_ASS(cpu, "d", cpu);
- WRITE_ASS(pid, "d", pid);
- WRITE_ASS(flags, "lu", flags);
+ __WRITE_ASS(fd, "d", fd);
+ __WRITE_ASS(group_fd, "d", group_fd);
+ __WRITE_ASS(cpu, "d", cpu);
+ __WRITE_ASS(pid, "d", pid);
+ __WRITE_ASS(flags, "lu", flags);
/* struct perf_event_attr */
- WRITE_ASS(type, PRIu32, attr->type);
- WRITE_ASS(size, PRIu32, attr->size);
- WRITE_ASS(config, "llu", attr->config);
- WRITE_ASS(sample_period, "llu", attr->sample_period);
- WRITE_ASS(sample_type, "llu", attr->sample_type);
- WRITE_ASS(read_format, "llu", attr->read_format);
- WRITE_ASS(disabled, "d", attr->disabled);
- WRITE_ASS(inherit, "d", attr->inherit);
- WRITE_ASS(pinned, "d", attr->pinned);
- WRITE_ASS(exclusive, "d", attr->exclusive);
- WRITE_ASS(exclude_user, "d", attr->exclude_user);
- WRITE_ASS(exclude_kernel, "d", attr->exclude_kernel);
- WRITE_ASS(exclude_hv, "d", attr->exclude_hv);
- WRITE_ASS(exclude_idle, "d", attr->exclude_idle);
- WRITE_ASS(mmap, "d", attr->mmap);
- WRITE_ASS(comm, "d", attr->comm);
- WRITE_ASS(freq, "d", attr->freq);
- WRITE_ASS(inherit_stat, "d", attr->inherit_stat);
- WRITE_ASS(enable_on_exec, "d", attr->enable_on_exec);
- WRITE_ASS(task, "d", attr->task);
- WRITE_ASS(watermask, "d", attr->watermark);
- WRITE_ASS(precise_ip, "d", attr->precise_ip);
- WRITE_ASS(mmap_data, "d", attr->mmap_data);
- WRITE_ASS(sample_id_all, "d", attr->sample_id_all);
- WRITE_ASS(exclude_host, "d", attr->exclude_host);
- WRITE_ASS(exclude_guest, "d", attr->exclude_guest);
- WRITE_ASS(exclude_callchain_kernel, "d",
- attr->exclude_callchain_kernel);
- WRITE_ASS(exclude_callchain_user, "d",
- attr->exclude_callchain_user);
- WRITE_ASS(wakeup_events, PRIu32, attr->wakeup_events);
- WRITE_ASS(bp_type, PRIu32, attr->bp_type);
- WRITE_ASS(config1, "llu", attr->config1);
- WRITE_ASS(config2, "llu", attr->config2);
- WRITE_ASS(branch_sample_type, "llu", attr->branch_sample_type);
- WRITE_ASS(sample_regs_user, "llu", attr->sample_regs_user);
- WRITE_ASS(sample_stack_user, PRIu32, attr->sample_stack_user);
- WRITE_ASS(optional, "d", 0);
+ WRITE_ASS(type, PRIu32);
+ WRITE_ASS(size, PRIu32);
+ WRITE_ASS(config, "llu");
+ WRITE_ASS(sample_period, "llu");
+ WRITE_ASS(sample_type, "llu");
+ WRITE_ASS(read_format, "llu");
+ WRITE_ASS(disabled, "d");
+ WRITE_ASS(inherit, "d");
+ WRITE_ASS(pinned, "d");
+ WRITE_ASS(exclusive, "d");
+ WRITE_ASS(exclude_user, "d");
+ WRITE_ASS(exclude_kernel, "d");
+ WRITE_ASS(exclude_hv, "d");
+ WRITE_ASS(exclude_idle, "d");
+ WRITE_ASS(mmap, "d");
+ WRITE_ASS(comm, "d");
+ WRITE_ASS(freq, "d");
+ WRITE_ASS(inherit_stat, "d");
+ WRITE_ASS(enable_on_exec, "d");
+ WRITE_ASS(task, "d");
+ WRITE_ASS(watermask, "d");
+ WRITE_ASS(precise_ip, "d");
+ WRITE_ASS(mmap_data, "d");
+ WRITE_ASS(sample_id_all, "d");
+ WRITE_ASS(exclude_host, "d");
+ WRITE_ASS(exclude_guest, "d");
+ WRITE_ASS(exclude_callchain_kernel, "d");
+ WRITE_ASS(exclude_callchain_user, "d");
+ WRITE_ASS(wakeup_events, PRIu32);
+ WRITE_ASS(bp_type, PRIu32);
+ WRITE_ASS(config1, "llu");
+ WRITE_ASS(config2, "llu");
+ WRITE_ASS(branch_sample_type, "llu");
+ WRITE_ASS(sample_regs_user, "llu");
+ WRITE_ASS(sample_stack_user, PRIu32);
+
+ __WRITE_ASS(optional, "d", 0);
fclose(file);
return 0;
--
1.7.11.7
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/4] perf tests: Fix attr watermark field name typo
2012-11-05 15:49 [PATCH 0/4] perf tests: Fixies for perf_event_attr tests Jiri Olsa
2012-11-05 15:49 ` [PATCH 1/4] perf tests: Add attr stat basic test Jiri Olsa
2012-11-05 15:49 ` [PATCH 2/4] perf tests: Factor attr tests WRITE_ASS macro Jiri Olsa
@ 2012-11-05 15:49 ` Jiri Olsa
2012-11-14 7:27 ` [tip:perf/core] " tip-bot for Jiri Olsa
2012-11-05 15:49 ` [PATCH 4/4] perf tests: Removing 'optional' field Jiri Olsa
3 siblings, 1 reply; 9+ messages in thread
From: Jiri Olsa @ 2012-11-05 15:49 UTC (permalink / raw)
To: linux-kernel
Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
Paul Mackerras, Corey Ashford, Frederic Weisbecker
Currently the 'watermark' field is coded as 'watermask'.
As the type is global through the framework and tests,
the typo spawned no error.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
---
tools/perf/tests/attr.c | 2 +-
tools/perf/tests/attr.py | 2 +-
tools/perf/tests/attr/base-record | 2 +-
tools/perf/tests/attr/base-stat | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index 1389d69..6fa84b7 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -110,7 +110,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,
WRITE_ASS(inherit_stat, "d");
WRITE_ASS(enable_on_exec, "d");
WRITE_ASS(task, "d");
- WRITE_ASS(watermask, "d");
+ WRITE_ASS(watermark, "d");
WRITE_ASS(precise_ip, "d");
WRITE_ASS(mmap_data, "d");
WRITE_ASS(sample_id_all, "d");
diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py
index e98c726..28c0481 100644
--- a/tools/perf/tests/attr.py
+++ b/tools/perf/tests/attr.py
@@ -45,7 +45,7 @@ class Event(dict):
'inherit_stat',
'enable_on_exec',
'task',
- 'watermask',
+ 'watermark',
'precise_ip',
'mmap_data',
'sample_id_all',
diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
index 07beef5..8262794 100644
--- a/tools/perf/tests/attr/base-record
+++ b/tools/perf/tests/attr/base-record
@@ -22,7 +22,7 @@ freq=1
inherit_stat=0
enable_on_exec=1
task=0
-watermask=0
+watermark=0
precise_ip=0
mmap_data=0
sample_id_all=1
diff --git a/tools/perf/tests/attr/base-stat b/tools/perf/tests/attr/base-stat
index 6e1bb8e..46f8851 100644
--- a/tools/perf/tests/attr/base-stat
+++ b/tools/perf/tests/attr/base-stat
@@ -22,7 +22,7 @@ freq=0
inherit_stat=0
enable_on_exec=1
task=0
-watermask=0
+watermark=0
precise_ip=0
mmap_data=0
sample_id_all=0
--
1.7.11.7
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/4] perf tests: Removing 'optional' field
2012-11-05 15:49 [PATCH 0/4] perf tests: Fixies for perf_event_attr tests Jiri Olsa
` (2 preceding siblings ...)
2012-11-05 15:49 ` [PATCH 3/4] perf tests: Fix attr watermark field name typo Jiri Olsa
@ 2012-11-05 15:49 ` Jiri Olsa
2012-11-14 7:28 ` [tip:perf/core] " tip-bot for Jiri Olsa
3 siblings, 1 reply; 9+ messages in thread
From: Jiri Olsa @ 2012-11-05 15:49 UTC (permalink / raw)
To: linux-kernel
Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
Paul Mackerras, Corey Ashford, Frederic Weisbecker
Since we allow multiple values in event field assignment, there's
no need for 'optional' field.. old version removal leftover.
Adding some comments into attr.py script regarding the test
event load.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
---
tools/perf/tests/attr.c | 2 --
tools/perf/tests/attr.py | 29 ++++++++++++++++++-----------
tools/perf/tests/attr/base-record | 1 -
tools/perf/tests/attr/base-stat | 1 -
4 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index 6fa84b7..6e2feee 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -126,8 +126,6 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,
WRITE_ASS(sample_regs_user, "llu");
WRITE_ASS(sample_stack_user, PRIu32);
- __WRITE_ASS(optional, "d", 0);
-
fclose(file);
return 0;
}
diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py
index 28c0481..9b25b33c 100644
--- a/tools/perf/tests/attr.py
+++ b/tools/perf/tests/attr.py
@@ -75,6 +75,7 @@ class Event(dict):
self.add(data)
def compare_data(self, a, b):
+ # Allow multiple values in assignment separated by '|'
a_list = a.split('|')
b_list = b.split('|')
@@ -96,12 +97,17 @@ class Event(dict):
return False
return True
- def is_optional(self):
- if self['optional'] == '1':
- return True
- else:
- return False
-
+# Test file description needs to have following sections:
+# [config]
+# - just single instance in file
+# - needs to specify:
+# 'command' - perf command name
+# 'args' - special command arguments
+# 'ret' - expected command return value (0 by default)
+#
+# [eventX:base]
+# - one or multiple instances in file
+# - expected values assignments
class Test(object):
def __init__(self, path, options):
parser = ConfigParser.SafeConfigParser()
@@ -135,11 +141,15 @@ class Test(object):
parser_event = ConfigParser.SafeConfigParser()
parser_event.read(path)
+ # The event record section header contains 'event' word,
+ # optionaly followed by ':' allowing to load 'parent
+ # event' first as a base
for section in filter(self.is_event, parser_event.sections()):
parser_items = parser_event.items(section);
base_items = {}
+ # Read parent event if there's any
if (':' in section):
base = section[section.index(':') + 1:]
parser_base = ConfigParser.SafeConfigParser()
@@ -177,11 +187,10 @@ class Test(object):
else:
log.debug(" ->FAIL");
- log.info(" match: [%s] optional(%d) matches %s" %
- (exp_name, exp_event.is_optional(), str(exp_list)))
+ log.info(" match: [%s] matches %s" % (exp_name, str(exp_list)))
# we did not any matching event - fail
- if (not exp_list) and (not exp_event.is_optional()):
+ if (not exp_list):
raise Fail(self, 'match failure');
match[exp_name] = exp_list
@@ -194,8 +203,6 @@ class Test(object):
if (group == ''):
continue
- # XXX group matching does not account for
- # optional events as above matching does
for res_name in match[exp_name]:
res_group = result[res_name].group
if res_group not in match[group]:
diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
index 8262794..f1485d8 100644
--- a/tools/perf/tests/attr/base-record
+++ b/tools/perf/tests/attr/base-record
@@ -37,4 +37,3 @@ config2=0
branch_sample_type=0
sample_regs_user=0
sample_stack_user=0
-optional=0
diff --git a/tools/perf/tests/attr/base-stat b/tools/perf/tests/attr/base-stat
index 46f8851..4bd79a8 100644
--- a/tools/perf/tests/attr/base-stat
+++ b/tools/perf/tests/attr/base-stat
@@ -37,4 +37,3 @@ config2=0
branch_sample_type=0
sample_regs_user=0
sample_stack_user=0
-optional=0
--
1.7.11.7
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [tip:perf/core] perf tests: Add missing attr stat basic test
2012-11-05 15:49 ` [PATCH 1/4] perf tests: Add attr stat basic test Jiri Olsa
@ 2012-11-14 7:25 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Jiri Olsa @ 2012-11-14 7:25 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra,
namhyung.kim, jolsa, fweisbec, tglx, cjashfor, mingo
Commit-ID: df4c6de857774252702acc20d4b0eddb329d8808
Gitweb: http://git.kernel.org/tip/df4c6de857774252702acc20d4b0eddb329d8808
Author: Jiri Olsa <jolsa@redhat.com>
AuthorDate: Mon, 5 Nov 2012 16:49:36 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Nov 2012 14:03:59 -0300
perf tests: Add missing attr stat basic test
Adding test to validate perf_event_attr data for command:
'stat -e cycles'
Reported-by: Namhyung Kim <namhyung.kim@lge.com>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1352130579-13451-2-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/attr/{base-record => base-stat} | 16 ++++++++--------
.../attr/{test-stat-no-inherit => test-stat-basic} | 3 +--
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-stat
similarity index 81%
copy from tools/perf/tests/attr/base-record
copy to tools/perf/tests/attr/base-stat
index 07beef5..6e1bb8e 100644
--- a/tools/perf/tests/attr/base-record
+++ b/tools/perf/tests/attr/base-stat
@@ -2,12 +2,12 @@
fd=1
group_fd=-1
flags=0
-type=0|1
+type=0
size=96
config=0
-sample_period=4000
-sample_type=263
-read_format=7
+sample_period=0
+sample_type=0
+read_format=3
disabled=1
inherit=1
pinned=0
@@ -16,16 +16,16 @@ exclude_user=0
exclude_kernel=0
exclude_hv=0
exclude_idle=0
-mmap=1
-comm=1
-freq=1
+mmap=0
+comm=0
+freq=0
inherit_stat=0
enable_on_exec=1
task=0
watermask=0
precise_ip=0
mmap_data=0
-sample_id_all=1
+sample_id_all=0
exclude_host=0
exclude_guest=1
exclude_callchain_kernel=0
diff --git a/tools/perf/tests/attr/test-stat-no-inherit b/tools/perf/tests/attr/test-stat-basic
similarity index 50%
copy from tools/perf/tests/attr/test-stat-no-inherit
copy to tools/perf/tests/attr/test-stat-basic
index d54b2a1e..74e1788 100644
--- a/tools/perf/tests/attr/test-stat-no-inherit
+++ b/tools/perf/tests/attr/test-stat-basic
@@ -1,7 +1,6 @@
[config]
command = stat
-args = -i -e cycles kill >/dev/null 2>&1
+args = -e cycles kill >/dev/null 2>&1
ret = 1
[event:base-stat]
-inherit=0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [tip:perf/core] perf tests: Factor attr tests WRITE_ASS macro
2012-11-05 15:49 ` [PATCH 2/4] perf tests: Factor attr tests WRITE_ASS macro Jiri Olsa
@ 2012-11-14 7:26 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Jiri Olsa @ 2012-11-14 7:26 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra,
namhyung.kim, jolsa, fweisbec, tglx, cjashfor, mingo
Commit-ID: 89f552d684925ef9f1dca8b4b2b18fb981dc3d8c
Gitweb: http://git.kernel.org/tip/89f552d684925ef9f1dca8b4b2b18fb981dc3d8c
Author: Jiri Olsa <jolsa@redhat.com>
AuthorDate: Mon, 5 Nov 2012 16:49:37 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Nov 2012 14:03:59 -0300
perf tests: Factor attr tests WRITE_ASS macro
Changing WRITE_ASS macro per Namhyung's comments, so the main usage case
takes only attr field name and format string.
Suggested-by: Namhyung Kim <namhyung.kim@lge.com>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1352130579-13451-3-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/attr.c | 89 ++++++++++++++++++++++++-----------------------
1 files changed, 45 insertions(+), 44 deletions(-)
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index aacad82..1389d69 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -44,7 +44,7 @@ void test_attr__init(void)
#define BUFSIZE 1024
-#define WRITE_ASS(str, fmt, data) \
+#define __WRITE_ASS(str, fmt, data) \
do { \
char buf[BUFSIZE]; \
size_t size; \
@@ -58,6 +58,8 @@ do { \
\
} while (0)
+#define WRITE_ASS(field, fmt) __WRITE_ASS(field, fmt, attr->field)
+
static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,
int fd, int group_fd, unsigned long flags)
{
@@ -81,51 +83,50 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,
}
/* syscall arguments */
- WRITE_ASS(fd, "d", fd);
- WRITE_ASS(group_fd, "d", group_fd);
- WRITE_ASS(cpu, "d", cpu);
- WRITE_ASS(pid, "d", pid);
- WRITE_ASS(flags, "lu", flags);
+ __WRITE_ASS(fd, "d", fd);
+ __WRITE_ASS(group_fd, "d", group_fd);
+ __WRITE_ASS(cpu, "d", cpu);
+ __WRITE_ASS(pid, "d", pid);
+ __WRITE_ASS(flags, "lu", flags);
/* struct perf_event_attr */
- WRITE_ASS(type, PRIu32, attr->type);
- WRITE_ASS(size, PRIu32, attr->size);
- WRITE_ASS(config, "llu", attr->config);
- WRITE_ASS(sample_period, "llu", attr->sample_period);
- WRITE_ASS(sample_type, "llu", attr->sample_type);
- WRITE_ASS(read_format, "llu", attr->read_format);
- WRITE_ASS(disabled, "d", attr->disabled);
- WRITE_ASS(inherit, "d", attr->inherit);
- WRITE_ASS(pinned, "d", attr->pinned);
- WRITE_ASS(exclusive, "d", attr->exclusive);
- WRITE_ASS(exclude_user, "d", attr->exclude_user);
- WRITE_ASS(exclude_kernel, "d", attr->exclude_kernel);
- WRITE_ASS(exclude_hv, "d", attr->exclude_hv);
- WRITE_ASS(exclude_idle, "d", attr->exclude_idle);
- WRITE_ASS(mmap, "d", attr->mmap);
- WRITE_ASS(comm, "d", attr->comm);
- WRITE_ASS(freq, "d", attr->freq);
- WRITE_ASS(inherit_stat, "d", attr->inherit_stat);
- WRITE_ASS(enable_on_exec, "d", attr->enable_on_exec);
- WRITE_ASS(task, "d", attr->task);
- WRITE_ASS(watermask, "d", attr->watermark);
- WRITE_ASS(precise_ip, "d", attr->precise_ip);
- WRITE_ASS(mmap_data, "d", attr->mmap_data);
- WRITE_ASS(sample_id_all, "d", attr->sample_id_all);
- WRITE_ASS(exclude_host, "d", attr->exclude_host);
- WRITE_ASS(exclude_guest, "d", attr->exclude_guest);
- WRITE_ASS(exclude_callchain_kernel, "d",
- attr->exclude_callchain_kernel);
- WRITE_ASS(exclude_callchain_user, "d",
- attr->exclude_callchain_user);
- WRITE_ASS(wakeup_events, PRIu32, attr->wakeup_events);
- WRITE_ASS(bp_type, PRIu32, attr->bp_type);
- WRITE_ASS(config1, "llu", attr->config1);
- WRITE_ASS(config2, "llu", attr->config2);
- WRITE_ASS(branch_sample_type, "llu", attr->branch_sample_type);
- WRITE_ASS(sample_regs_user, "llu", attr->sample_regs_user);
- WRITE_ASS(sample_stack_user, PRIu32, attr->sample_stack_user);
- WRITE_ASS(optional, "d", 0);
+ WRITE_ASS(type, PRIu32);
+ WRITE_ASS(size, PRIu32);
+ WRITE_ASS(config, "llu");
+ WRITE_ASS(sample_period, "llu");
+ WRITE_ASS(sample_type, "llu");
+ WRITE_ASS(read_format, "llu");
+ WRITE_ASS(disabled, "d");
+ WRITE_ASS(inherit, "d");
+ WRITE_ASS(pinned, "d");
+ WRITE_ASS(exclusive, "d");
+ WRITE_ASS(exclude_user, "d");
+ WRITE_ASS(exclude_kernel, "d");
+ WRITE_ASS(exclude_hv, "d");
+ WRITE_ASS(exclude_idle, "d");
+ WRITE_ASS(mmap, "d");
+ WRITE_ASS(comm, "d");
+ WRITE_ASS(freq, "d");
+ WRITE_ASS(inherit_stat, "d");
+ WRITE_ASS(enable_on_exec, "d");
+ WRITE_ASS(task, "d");
+ WRITE_ASS(watermask, "d");
+ WRITE_ASS(precise_ip, "d");
+ WRITE_ASS(mmap_data, "d");
+ WRITE_ASS(sample_id_all, "d");
+ WRITE_ASS(exclude_host, "d");
+ WRITE_ASS(exclude_guest, "d");
+ WRITE_ASS(exclude_callchain_kernel, "d");
+ WRITE_ASS(exclude_callchain_user, "d");
+ WRITE_ASS(wakeup_events, PRIu32);
+ WRITE_ASS(bp_type, PRIu32);
+ WRITE_ASS(config1, "llu");
+ WRITE_ASS(config2, "llu");
+ WRITE_ASS(branch_sample_type, "llu");
+ WRITE_ASS(sample_regs_user, "llu");
+ WRITE_ASS(sample_stack_user, PRIu32);
+
+ __WRITE_ASS(optional, "d", 0);
fclose(file);
return 0;
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [tip:perf/core] perf tests: Fix attr watermark field name typo
2012-11-05 15:49 ` [PATCH 3/4] perf tests: Fix attr watermark field name typo Jiri Olsa
@ 2012-11-14 7:27 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Jiri Olsa @ 2012-11-14 7:27 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, jolsa,
fweisbec, tglx, cjashfor, mingo
Commit-ID: 45e4089bc6398da2cf0609b614bc519970cb8442
Gitweb: http://git.kernel.org/tip/45e4089bc6398da2cf0609b614bc519970cb8442
Author: Jiri Olsa <jolsa@redhat.com>
AuthorDate: Mon, 5 Nov 2012 16:49:38 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Nov 2012 14:03:59 -0300
perf tests: Fix attr watermark field name typo
Currently the 'watermark' field is coded as 'watermask'.
As the type is global through the framework and tests, the typo spawned
no error.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1352130579-13451-4-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/attr.c | 2 +-
tools/perf/tests/attr.py | 2 +-
tools/perf/tests/attr/base-record | 2 +-
tools/perf/tests/attr/base-stat | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index 1389d69..6fa84b7 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -110,7 +110,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,
WRITE_ASS(inherit_stat, "d");
WRITE_ASS(enable_on_exec, "d");
WRITE_ASS(task, "d");
- WRITE_ASS(watermask, "d");
+ WRITE_ASS(watermark, "d");
WRITE_ASS(precise_ip, "d");
WRITE_ASS(mmap_data, "d");
WRITE_ASS(sample_id_all, "d");
diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py
index e98c726..28c0481 100644
--- a/tools/perf/tests/attr.py
+++ b/tools/perf/tests/attr.py
@@ -45,7 +45,7 @@ class Event(dict):
'inherit_stat',
'enable_on_exec',
'task',
- 'watermask',
+ 'watermark',
'precise_ip',
'mmap_data',
'sample_id_all',
diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
index 07beef5..8262794 100644
--- a/tools/perf/tests/attr/base-record
+++ b/tools/perf/tests/attr/base-record
@@ -22,7 +22,7 @@ freq=1
inherit_stat=0
enable_on_exec=1
task=0
-watermask=0
+watermark=0
precise_ip=0
mmap_data=0
sample_id_all=1
diff --git a/tools/perf/tests/attr/base-stat b/tools/perf/tests/attr/base-stat
index 6e1bb8e..46f8851 100644
--- a/tools/perf/tests/attr/base-stat
+++ b/tools/perf/tests/attr/base-stat
@@ -22,7 +22,7 @@ freq=0
inherit_stat=0
enable_on_exec=1
task=0
-watermask=0
+watermark=0
precise_ip=0
mmap_data=0
sample_id_all=0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [tip:perf/core] perf tests: Removing 'optional' field
2012-11-05 15:49 ` [PATCH 4/4] perf tests: Removing 'optional' field Jiri Olsa
@ 2012-11-14 7:28 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Jiri Olsa @ 2012-11-14 7:28 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, jolsa,
fweisbec, tglx, cjashfor, mingo
Commit-ID: 8dfec403e39b7c37fd6e8813bacc01da1e1210ab
Gitweb: http://git.kernel.org/tip/8dfec403e39b7c37fd6e8813bacc01da1e1210ab
Author: Jiri Olsa <jolsa@redhat.com>
AuthorDate: Mon, 5 Nov 2012 16:49:39 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Nov 2012 14:03:59 -0300
perf tests: Removing 'optional' field
Since we allow multiple values in event field assignment, there's no
need for 'optional' field.. old version removal leftover.
Adding some comments into attr.py script regarding the test event load.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1352130579-13451-5-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/attr.c | 2 --
tools/perf/tests/attr.py | 29 ++++++++++++++++++-----------
tools/perf/tests/attr/base-record | 1 -
tools/perf/tests/attr/base-stat | 1 -
4 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index 6fa84b7..6e2feee 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -126,8 +126,6 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,
WRITE_ASS(sample_regs_user, "llu");
WRITE_ASS(sample_stack_user, PRIu32);
- __WRITE_ASS(optional, "d", 0);
-
fclose(file);
return 0;
}
diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py
index 28c0481..9b25b33c 100644
--- a/tools/perf/tests/attr.py
+++ b/tools/perf/tests/attr.py
@@ -75,6 +75,7 @@ class Event(dict):
self.add(data)
def compare_data(self, a, b):
+ # Allow multiple values in assignment separated by '|'
a_list = a.split('|')
b_list = b.split('|')
@@ -96,12 +97,17 @@ class Event(dict):
return False
return True
- def is_optional(self):
- if self['optional'] == '1':
- return True
- else:
- return False
-
+# Test file description needs to have following sections:
+# [config]
+# - just single instance in file
+# - needs to specify:
+# 'command' - perf command name
+# 'args' - special command arguments
+# 'ret' - expected command return value (0 by default)
+#
+# [eventX:base]
+# - one or multiple instances in file
+# - expected values assignments
class Test(object):
def __init__(self, path, options):
parser = ConfigParser.SafeConfigParser()
@@ -135,11 +141,15 @@ class Test(object):
parser_event = ConfigParser.SafeConfigParser()
parser_event.read(path)
+ # The event record section header contains 'event' word,
+ # optionaly followed by ':' allowing to load 'parent
+ # event' first as a base
for section in filter(self.is_event, parser_event.sections()):
parser_items = parser_event.items(section);
base_items = {}
+ # Read parent event if there's any
if (':' in section):
base = section[section.index(':') + 1:]
parser_base = ConfigParser.SafeConfigParser()
@@ -177,11 +187,10 @@ class Test(object):
else:
log.debug(" ->FAIL");
- log.info(" match: [%s] optional(%d) matches %s" %
- (exp_name, exp_event.is_optional(), str(exp_list)))
+ log.info(" match: [%s] matches %s" % (exp_name, str(exp_list)))
# we did not any matching event - fail
- if (not exp_list) and (not exp_event.is_optional()):
+ if (not exp_list):
raise Fail(self, 'match failure');
match[exp_name] = exp_list
@@ -194,8 +203,6 @@ class Test(object):
if (group == ''):
continue
- # XXX group matching does not account for
- # optional events as above matching does
for res_name in match[exp_name]:
res_group = result[res_name].group
if res_group not in match[group]:
diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
index 8262794..f1485d8 100644
--- a/tools/perf/tests/attr/base-record
+++ b/tools/perf/tests/attr/base-record
@@ -37,4 +37,3 @@ config2=0
branch_sample_type=0
sample_regs_user=0
sample_stack_user=0
-optional=0
diff --git a/tools/perf/tests/attr/base-stat b/tools/perf/tests/attr/base-stat
index 46f8851..4bd79a8 100644
--- a/tools/perf/tests/attr/base-stat
+++ b/tools/perf/tests/attr/base-stat
@@ -37,4 +37,3 @@ config2=0
branch_sample_type=0
sample_regs_user=0
sample_stack_user=0
-optional=0
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-11-14 7:30 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-05 15:49 [PATCH 0/4] perf tests: Fixies for perf_event_attr tests Jiri Olsa
2012-11-05 15:49 ` [PATCH 1/4] perf tests: Add attr stat basic test Jiri Olsa
2012-11-14 7:25 ` [tip:perf/core] perf tests: Add missing " tip-bot for Jiri Olsa
2012-11-05 15:49 ` [PATCH 2/4] perf tests: Factor attr tests WRITE_ASS macro Jiri Olsa
2012-11-14 7:26 ` [tip:perf/core] " tip-bot for Jiri Olsa
2012-11-05 15:49 ` [PATCH 3/4] perf tests: Fix attr watermark field name typo Jiri Olsa
2012-11-14 7:27 ` [tip:perf/core] " tip-bot for Jiri Olsa
2012-11-05 15:49 ` [PATCH 4/4] perf tests: Removing 'optional' field Jiri Olsa
2012-11-14 7:28 ` [tip:perf/core] " tip-bot for Jiri Olsa
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.