Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH 06/25] perf tests: Add attr record event syntax group test

42 views
Skip to first unread message

Jiri Olsa

unread,
Oct 30, 2012, 6:02:46 PM10/30/12
to linux-...@vger.kernel.org, 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:
'record group -e {cycles,instructions}'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/tests/attr/test-record-group1 | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 tools/perf/tests/attr/test-record-group1

diff --git a/tools/perf/tests/attr/test-record-group1 b/tools/perf/tests/attr/test-record-group1
new file mode 100644
index 0000000..39bf860
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-group1
@@ -0,0 +1,20 @@
+[config]
+command = record
+args = -e '{cycles,instructions}' kill >/tmp/krava 2>&1
+
+[event-1:base-record]
+fd=1
+group_fd=-1
+sample_type=327
+
+[event-2:base-record]
+fd=2
+group_fd=1
+type=0
+config=1
+sample_type=327
+mmap=0
+comm=0
+# TODO this is disabled for --group option, enabled otherwise
+# check why..
+enable_on_exec=1
--
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Jiri Olsa

unread,
Oct 30, 2012, 6:02:48 PM10/30/12
to linux-...@vger.kernel.org, Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
It's not needed.

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/Makefile | 1 -
1 file changed, 1 deletion(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index b1801e0..3e807d7 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -893,7 +893,6 @@ $(OUTPUT)%.s: %.S
$(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
'-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \
- '-DBINDIR="$(bindir_relative_SQ)"' \
'-DPREFIX="$(prefix_SQ)"' \
$<

Jiri Olsa

unread,
Oct 30, 2012, 6:02:50 PM10/30/12
to linux-...@vger.kernel.org, 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:
'record -c 123'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/tests/attr/test-record-count | 8 ++++++++
1 file changed, 8 insertions(+)
create mode 100644 tools/perf/tests/attr/test-record-count

diff --git a/tools/perf/tests/attr/test-record-count b/tools/perf/tests/attr/test-record-count
new file mode 100644
index 0000000..2f841de
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-count
@@ -0,0 +1,8 @@
+[config]
+command = record
+args = -c 123 kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=123
+sample_type=7
+freq=0

Jiri Olsa

unread,
Oct 30, 2012, 6:02:59 PM10/30/12
to linux-...@vger.kernel.org, Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
Adding tests to validate perf_event_attr data for commands:
'record -g --'
'record -g fp
'record -g dwarf

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/tests/attr/test-record-graph-default | 6 ++++++
tools/perf/tests/attr/test-record-graph-dwarf | 10 ++++++++++
tools/perf/tests/attr/test-record-graph-fp | 6 ++++++
3 files changed, 22 insertions(+)
create mode 100644 tools/perf/tests/attr/test-record-graph-default
create mode 100644 tools/perf/tests/attr/test-record-graph-dwarf
create mode 100644 tools/perf/tests/attr/test-record-graph-fp

diff --git a/tools/perf/tests/attr/test-record-graph-default b/tools/perf/tests/attr/test-record-graph-default
new file mode 100644
index 0000000..833d184
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-graph-default
@@ -0,0 +1,6 @@
+[config]
+command = record
+args = -g -- kill >/dev/null 2>&1
+
+[event:base-record]
+sample_type=295
diff --git a/tools/perf/tests/attr/test-record-graph-dwarf b/tools/perf/tests/attr/test-record-graph-dwarf
new file mode 100644
index 0000000..e93e082
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-graph-dwarf
@@ -0,0 +1,10 @@
+[config]
+command = record
+args = -g dwarf -- kill >/dev/null 2>&1
+
+[event:base-record]
+sample_type=12583
+exclude_callchain_user=1
+sample_stack_user=8192
+# TODO different for each arch, no support for that now
+sample_regs_user=*
diff --git a/tools/perf/tests/attr/test-record-graph-fp b/tools/perf/tests/attr/test-record-graph-fp
new file mode 100644
index 0000000..7cef374
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-graph-fp
@@ -0,0 +1,6 @@
+[config]
+command = record
+args = -g fp kill >/dev/null 2>&1
+
+[event:base-record]
+sample_type=295

Jiri Olsa

unread,
Oct 30, 2012, 6:03:02 PM10/30/12
to linux-...@vger.kernel.org, Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
From: "jo...@redhat.com" <jo...@redhat.com>

Adding test to validate perf_event_attr data for command:
'record -d'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/tests/attr/test-record-data | 8 ++++++++
1 file changed, 8 insertions(+)
create mode 100644 tools/perf/tests/attr/test-record-data

diff --git a/tools/perf/tests/attr/test-record-data b/tools/perf/tests/attr/test-record-data
new file mode 100644
index 0000000..6627c3e
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-data
@@ -0,0 +1,8 @@
+[config]
+command = record
+args = -d kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=271
+mmap_data=1

Jiri Olsa

unread,
Oct 30, 2012, 6:03:09 PM10/30/12
to linux-...@vger.kernel.org, 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:
'record -i'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/tests/attr/test-record-no-inherit | 7 +++++++
1 file changed, 7 insertions(+)
create mode 100644 tools/perf/tests/attr/test-record-no-inherit

diff --git a/tools/perf/tests/attr/test-record-no-inherit b/tools/perf/tests/attr/test-record-no-inherit
new file mode 100644
index 0000000..9079a25
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-no-inherit
@@ -0,0 +1,7 @@
+[config]
+command = record
+args = -i kill >/dev/null 2>&1
+
+[event:base-record]
+sample_type=259
+inherit=0

Jiri Olsa

unread,
Oct 30, 2012, 6:03:14 PM10/30/12
to linux-...@vger.kernel.org, Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
From: "jo...@redhat.com" <jo...@redhat.com>

Adding test to validate perf_event_attr data for command:
'record -b'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/tests/attr/test-record-branch-any | 8 ++++++++
1 file changed, 8 insertions(+)
create mode 100644 tools/perf/tests/attr/test-record-branch-any

diff --git a/tools/perf/tests/attr/test-record-branch-any b/tools/perf/tests/attr/test-record-branch-any
new file mode 100644
index 0000000..1421960
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-branch-any
@@ -0,0 +1,8 @@
+[config]
+command = record
+args = -b kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=2311
+branch_sample_type=8

Jiri Olsa

unread,
Oct 30, 2012, 6:03:22 PM10/30/12
to linux-...@vger.kernel.org, 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 <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@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]

Jiri Olsa

unread,
Oct 30, 2012, 6:03:24 PM10/30/12
to linux-...@vger.kernel.org, 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,instructions}'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/tests/attr/test-stat-group1 | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
create mode 100644 tools/perf/tests/attr/test-stat-group1

diff --git a/tools/perf/tests/attr/test-stat-group1 b/tools/perf/tests/attr/test-stat-group1
new file mode 100644
index 0000000..5ae2718
--- /dev/null
+++ b/tools/perf/tests/attr/test-stat-group1
@@ -0,0 +1,17 @@
+[config]
+command = stat
+args = -e '{cycles,instructions}' kill >/dev/null 2>&1
+ret = 1
+
+[event-1:base-stat]
+fd=1
+group_fd=-1
+
+[event-2:base-stat]
+fd=2
+group_fd=1
+config=1
+# TODO both disabled and enable_on_exec are disabled for --group option,
+# enabled otherwise, check why..
+disabled=1
+enable_on_exec=1

Jiri Olsa

unread,
Oct 30, 2012, 6:03:30 PM10/30/12
to linux-...@vger.kernel.org, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
hi,
this code tests the link between perf stat/record command line
options and final perf_event_attr struct values. Also it tests
the group fd linkage.

Plus moving test related objects under 'test' directory.

Attached patches:
01/25 perf tools: Remove BINDIR define from exec_cmd.o
02/25 perf tests: Move test objects into 'tests' directory
03/25 perf tests: Add framework for automated
04/25 perf tests: Add attr record basic test
05/25 perf tests: Add attr record group test
06/25 perf tests: Add attr record event syntax group test
07/25 perf tests: Add attr record freq test
08/25 perf tests: Add attr record count test
09/25 perf tests: Add attr record graph test
10/25 perf tests: Add attr record period test
11/25 perf tests: Add attr record no samples test
12/25 perf tests: Add attr record no-inherit test
13/25 perf tests: Add attr record data test
14/25 perf tests: Add attr record raw test
15/25 perf tests: Add attr record no delay test
16/25 perf tests: Add attr record branch any test
17/25 perf tests: Add attr record branch filter tests
18/25 perf tests: Add attr stat basic test
19/25 perf tests: Add attr stat no-inherit test
20/25 perf tests: Add attr stat group test
21/25 perf tests: Add attr stat event syntax group test
22/25 perf tests: Add attr stat default test
23/25 perf tests: Add attr stat default test
24/25 perf tests: Add attr tests under builtin test command
25/25 perf tests: Add documentation for attr tests

Also available here:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/linux.git
perf/test4

thanks,
jirka


Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/Makefile | 20 +-
tools/perf/builtin-test.c | 1559 ---------------------------------------------------------------------
tools/perf/perf.c | 2 +
tools/perf/perf.h | 17 +-
tools/perf/tests/attr.c | 171 ++++++++
tools/perf/tests/attr.py | 313 ++++++++++++++
tools/perf/tests/attr/README | 64 +++
tools/perf/tests/attr/base-record | 40 ++
tools/perf/tests/attr/base-stat | 40 ++
tools/perf/tests/attr/test-record-basic | 5 +
tools/perf/tests/attr/test-record-branch-any | 8 +
tools/perf/tests/attr/test-record-branch-filter-any | 8 +
tools/perf/tests/attr/test-record-branch-filter-any_call | 8 +
tools/perf/tests/attr/test-record-branch-filter-any_ret | 8 +
tools/perf/tests/attr/test-record-branch-filter-hv | 8 +
tools/perf/tests/attr/test-record-branch-filter-ind_call | 8 +
tools/perf/tests/attr/test-record-branch-filter-k | 8 +
tools/perf/tests/attr/test-record-branch-filter-u | 8 +
tools/perf/tests/attr/test-record-count | 8 +
tools/perf/tests/attr/test-record-data | 8 +
tools/perf/tests/attr/test-record-freq | 6 +
tools/perf/tests/attr/test-record-graph-default | 6 +
tools/perf/tests/attr/test-record-graph-dwarf | 10 +
tools/perf/tests/attr/test-record-graph-fp | 6 +
tools/perf/tests/attr/test-record-group | 17 +
tools/perf/tests/attr/test-record-group1 | 20 +
tools/perf/tests/attr/test-record-no-delay | 9 +
tools/perf/tests/attr/test-record-no-inherit | 7 +
tools/perf/tests/attr/test-record-no-samples | 6 +
tools/perf/tests/attr/test-record-period | 7 +
tools/perf/tests/attr/test-record-raw | 7 +
tools/perf/tests/attr/test-stat-basic | 6 +
tools/perf/tests/attr/test-stat-default | 64 +++
tools/perf/tests/attr/test-stat-detailed-1 | 101 +++++
tools/perf/tests/attr/test-stat-detailed-2 | 155 +++++++
tools/perf/tests/attr/test-stat-detailed-3 | 173 ++++++++
tools/perf/tests/attr/test-stat-group | 15 +
tools/perf/tests/attr/test-stat-group1 | 17 +
tools/perf/tests/attr/test-stat-no-inherit | 7 +
tools/perf/tests/builtin-test.c | 1563 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/perf/tests/dso-data.c | 153 +++++++
tools/perf/tests/parse-events.c | 1116 ++++++++++++++++++++++++++++++++++++++++++++++++++
tools/perf/util/dso-test-data.c | 153 -------
tools/perf/util/parse-events-test.c | 1116 --------------------------------------------------
44 files changed, 4216 insertions(+), 2835 deletions(-)

Jiri Olsa

unread,
Oct 30, 2012, 6:03:39 PM10/30/12
to linux-...@vger.kernel.org, Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
The test attr suite is run only if it's run under perf source
directory, or tests are found in installed path.

Otherwise tests are omitted (notification is displayed)
and finished as successful.

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/Makefile | 9 +++++++++
tools/perf/perf.h | 1 +
tools/perf/tests/attr.c | 35 +++++++++++++++++++++++++++++++++++
tools/perf/tests/builtin-test.c | 4 ++++
4 files changed, 49 insertions(+)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 1da87a3..ba380b9 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -898,6 +898,11 @@ $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
'-DPREFIX="$(prefix_SQ)"' \
$<

+$(OUTPUT)tests/attr.o: $(OUTPUT)tests/attr.c $(OUTPUT)PERF-CFLAGS
+ $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
+ '-DBINDIR="$(bindir_SQ)"' \
+ $<
+
$(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<

@@ -1062,6 +1067,10 @@ install: all try-install-man
$(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'
$(INSTALL) bash_completion '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
+ $(INSTALL) tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
+ $(INSTALL) tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'

install-python_ext:
$(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 0047264..054182e 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -178,6 +178,7 @@ extern bool test_attr__enabled;
void test_attr__init(void);
void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
int fd, int group_fd, unsigned long flags);
+int test_attr__run(void);

static inline int
sys_perf_event_open(struct perf_event_attr *attr,
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index 2fe8cae..ef2505e 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -26,9 +26,12 @@
#include <linux/kernel.h>
#include "../perf.h"
#include "util.h"
+#include "exec_cmd.h"

#define ENV "PERF_TEST_ATTR"

+extern int verbose;
+
bool test_attr__enabled;

static char *dir;
@@ -134,3 +137,35 @@ void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
if (store_event(attr, pid, cpu, fd, group_fd, flags))
die("test attr FAILED");
}
+
+static int run_dir(const char *d, const char *perf)
+{
+ char cmd[3*PATH_MAX];
+
+ snprintf(cmd, 3*PATH_MAX, "python %s/attr.py -d %s/attr/ -p %s %s",
+ d, d, perf, verbose ? "-v" : "");
+
+ return system(cmd);
+}
+
+int test_attr__run(void)
+{
+ struct stat st;
+ char path_perf[PATH_MAX];
+ char path_dir[PATH_MAX];
+
+ /* First try developement tree tests. */
+ if (!lstat("./tests", &st))
+ return run_dir("./tests", "./perf");
+
+ /* Then installed path. */
+ snprintf(path_dir, PATH_MAX, "%s/tests", perf_exec_path());
+ snprintf(path_perf, PATH_MAX, "%s/perf", BINDIR);
+
+ if (!lstat(path_dir, &st) &&
+ !lstat(path_perf, &st))
+ return run_dir(path_dir, path_perf);
+
+ fprintf(stderr, " (ommitted)");
+ return 0;
+}
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index a04276e..8e2e7d6 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -1455,6 +1455,10 @@ static struct test {
.func = test__syscall_open_tp_fields,
},
{
+ .desc = "struct perf_event_attr setup",
+ .func = test_attr__run,
+ },
+ {
.func = NULL,
},
};
--
1.7.11.7

Jiri Olsa

unread,
Oct 30, 2012, 6:03:54 PM10/30/12
to linux-...@vger.kernel.org, Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
Adding documentation for attr tests.

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/tests/attr/README | 64 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
create mode 100644 tools/perf/tests/attr/README

diff --git a/tools/perf/tests/attr/README b/tools/perf/tests/attr/README
new file mode 100644
index 0000000..d102957
--- /dev/null
+++ b/tools/perf/tests/attr/README
@@ -0,0 +1,64 @@
+The struct perf_event_attr test (attr tests) support
+====================================================
+This testing support is embedded into perf directly and is governed
+by the PERF_TEST_ATTR environment variable and hook inside the
+sys_perf_event_open function.
+
+The general idea is to store 'struct perf_event_attr' details for
+each event created within single perf command. Each event details
+are stored into separate text file. Once perf command is finished
+these files are checked for values we expect for command.
+
+The attr tests consist of following parts:
+
+tests/attr.c
+------------
+This is the sys_perf_event_open hook implementation. The hook
+is triggered when the PERF_TEST_ATTR environment variable is
+defined. It must contain name of existing directory with access
+and write permissions.
+
+For each sys_perf_event_open call event details are stored in
+separate file. Besides 'struct perf_event_attr' values we also
+store 'fd' and 'group_fd' values to allow checking for groups.
+
+tests/attr.py
+-------------
+This is the python script that does all the hard work. It reads
+the test definition, executes it and checks results.
+
+tests/attr/
+-----------
+Directory containing all attr test definitions.
+Following tests are defined (with perf commands):
+
+ perf record kill (test-record-basic)
+ perf record -b kill (test-record-branch-any)
+ perf record -j any kill (test-record-branch-filter-any)
+ perf record -j any_call kill (test-record-branch-filter-any_call)
+ perf record -j any_ret kill (test-record-branch-filter-any_ret)
+ perf record -j hv kill (test-record-branch-filter-hv)
+ perf record -j ind_call kill (test-record-branch-filter-ind_call)
+ perf record -j k kill (test-record-branch-filter-k)
+ perf record -j u kill (test-record-branch-filter-u)
+ perf record -c 123 kill (test-record-count)
+ perf record -d kill (test-record-data)
+ perf record -F 100 kill (test-record-freq)
+ perf record -g -- kill (test-record-graph-default)
+ perf record -g dwarf -- kill (test-record-graph-dwarf)
+ perf record -g fp kill (test-record-graph-fp)
+ perf record --group -e cycles,instructions kill (test-record-group)
+ perf record -e '{cycles,instructions}' kill (test-record-group1)
+ perf record -D kill (test-record-no-delay)
+ perf record -i kill (test-record-no-inherit)
+ perf record -n kill (test-record-no-samples)
+ perf record -c 100 -P kill (test-record-period)
+ perf record -R kill (test-record-raw)
+ perf stat -e cycles kill (test-stat-basic)
+ perf stat kill (test-stat-default)
+ perf stat -d kill (test-stat-detailed-1)
+ perf stat -dd kill (test-stat-detailed-2)
+ perf stat -ddd kill (test-stat-detailed-3)
+ perf stat --group -e cycles,instructions kill (test-stat-group)
+ perf stat -e '{cycles,instructions}' kill (test-stat-group1)
+ perf stat -i -e cycles kill (test-stat-no-inherit)
--
1.7.11.7

Jiri Olsa

unread,
Oct 30, 2012, 6:04:16 PM10/30/12
to linux-...@vger.kernel.org, Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
From: "jo...@redhat.com" <jo...@redhat.com>

Adding test to validate perf_event_attr data for commands:
'stat -d'
'stat -dd'
'stat -ddd'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/tests/attr/test-stat-detailed-1 | 101 +++++++++++++++++
tools/perf/tests/attr/test-stat-detailed-2 | 155 ++++++++++++++++++++++++++
tools/perf/tests/attr/test-stat-detailed-3 | 173 +++++++++++++++++++++++++++++
3 files changed, 429 insertions(+)
create mode 100644 tools/perf/tests/attr/test-stat-detailed-1
create mode 100644 tools/perf/tests/attr/test-stat-detailed-2
create mode 100644 tools/perf/tests/attr/test-stat-detailed-3

diff --git a/tools/perf/tests/attr/test-stat-detailed-1 b/tools/perf/tests/attr/test-stat-detailed-1
new file mode 100644
index 0000000..51426b8
--- /dev/null
+++ b/tools/perf/tests/attr/test-stat-detailed-1
@@ -0,0 +1,101 @@
+[config]
+command = stat
+args = -d kill >/dev/null 2>&1
+ret = 1
+
+
+# PERF_TYPE_SOFTWARE / PERF_COUNT_SW_TASK_CLOCK
+[event1:base-stat]
+fd=1
+type=1
+config=1
+
+# PERF_TYPE_SOFTWARE / PERF_COUNT_SW_CONTEXT_SWITCHES
+[event2:base-stat]
+fd=2
+type=1
+config=3
+
+# PERF_TYPE_SOFTWARE / PERF_COUNT_SW_CPU_MIGRATIONS
+[event3:base-stat]
+fd=3
+type=1
+config=4
+
+# PERF_TYPE_SOFTWARE / PERF_COUNT_SW_PAGE_FAULTS
+[event4:base-stat]
+fd=4
+type=1
+config=2
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_CPU_CYCLES
+[event5:base-stat]
+fd=5
+type=0
+config=0
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_FRONTEND
+[event6:base-stat]
+fd=6
+type=0
+config=7
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND
+[event7:base-stat]
+fd=7
+type=0
+config=8
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS
+[event8:base-stat]
+fd=8
+type=0
+config=1
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_INSTRUCTIONS
+[event9:base-stat]
+fd=9
+type=0
+config=4
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_MISSES
+[event10:base-stat]
+fd=10
+type=0
+config=5
+
+# PERF_TYPE_HW_CACHE /
+# PERF_COUNT_HW_CACHE_L1D << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event11:base-stat]
+fd=11
+type=3
+config=0
+
+# PERF_TYPE_HW_CACHE /
+# PERF_COUNT_HW_CACHE_L1D << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event12:base-stat]
+fd=12
+type=3
+config=65536
+
+# PERF_TYPE_HW_CACHE /
+# PERF_COUNT_HW_CACHE_LL << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event13:base-stat]
+fd=13
+type=3
+config=2
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_LL << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event14:base-stat]
+fd=14
+type=3
+config=65538
diff --git a/tools/perf/tests/attr/test-stat-detailed-2 b/tools/perf/tests/attr/test-stat-detailed-2
new file mode 100644
index 0000000..8de5acc
--- /dev/null
+++ b/tools/perf/tests/attr/test-stat-detailed-2
@@ -0,0 +1,155 @@
+[config]
+command = stat
+args = -dd kill >/dev/null 2>&1
+ret = 1
+
+
+# PERF_TYPE_SOFTWARE / PERF_COUNT_SW_TASK_CLOCK
+[event1:base-stat]
+fd=1
+type=1
+config=1
+
+# PERF_TYPE_SOFTWARE / PERF_COUNT_SW_CONTEXT_SWITCHES
+[event2:base-stat]
+fd=2
+type=1
+config=3
+
+# PERF_TYPE_SOFTWARE / PERF_COUNT_SW_CPU_MIGRATIONS
+[event3:base-stat]
+fd=3
+type=1
+config=4
+
+# PERF_TYPE_SOFTWARE / PERF_COUNT_SW_PAGE_FAULTS
+[event4:base-stat]
+fd=4
+type=1
+config=2
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_CPU_CYCLES
+[event5:base-stat]
+fd=5
+type=0
+config=0
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_FRONTEND
+[event6:base-stat]
+fd=6
+type=0
+config=7
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND
+[event7:base-stat]
+fd=7
+type=0
+config=8
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS
+[event8:base-stat]
+fd=8
+type=0
+config=1
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_INSTRUCTIONS
+[event9:base-stat]
+fd=9
+type=0
+config=4
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_MISSES
+[event10:base-stat]
+fd=10
+type=0
+config=5
+
+# PERF_TYPE_HW_CACHE /
+# PERF_COUNT_HW_CACHE_L1D << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event11:base-stat]
+fd=11
+type=3
+config=0
+
+# PERF_TYPE_HW_CACHE /
+# PERF_COUNT_HW_CACHE_L1D << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event12:base-stat]
+fd=12
+type=3
+config=65536
+
+# PERF_TYPE_HW_CACHE /
+# PERF_COUNT_HW_CACHE_LL << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event13:base-stat]
+fd=13
+type=3
+config=2
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_LL << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event14:base-stat]
+fd=14
+type=3
+config=65538
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_L1I << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event15:base-stat]
+fd=15
+type=3
+config=1
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_L1I << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event16:base-stat]
+fd=16
+type=3
+config=65537
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_DTLB << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event17:base-stat]
+fd=17
+type=3
+config=3
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_DTLB << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event18:base-stat]
+fd=18
+type=3
+config=65539
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_ITLB << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event19:base-stat]
+fd=19
+type=3
+config=4
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_ITLB << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event20:base-stat]
+fd=20
+type=3
+config=65540
diff --git a/tools/perf/tests/attr/test-stat-detailed-3 b/tools/perf/tests/attr/test-stat-detailed-3
new file mode 100644
index 0000000..0a1f45b
--- /dev/null
+++ b/tools/perf/tests/attr/test-stat-detailed-3
@@ -0,0 +1,173 @@
+[config]
+command = stat
+args = -ddd kill >/dev/null 2>&1
+ret = 1
+
+
+# PERF_TYPE_SOFTWARE / PERF_COUNT_SW_TASK_CLOCK
+[event1:base-stat]
+fd=1
+type=1
+config=1
+
+# PERF_TYPE_SOFTWARE / PERF_COUNT_SW_CONTEXT_SWITCHES
+[event2:base-stat]
+fd=2
+type=1
+config=3
+
+# PERF_TYPE_SOFTWARE / PERF_COUNT_SW_CPU_MIGRATIONS
+[event3:base-stat]
+fd=3
+type=1
+config=4
+
+# PERF_TYPE_SOFTWARE / PERF_COUNT_SW_PAGE_FAULTS
+[event4:base-stat]
+fd=4
+type=1
+config=2
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_CPU_CYCLES
+[event5:base-stat]
+fd=5
+type=0
+config=0
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_FRONTEND
+[event6:base-stat]
+fd=6
+type=0
+config=7
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND
+[event7:base-stat]
+fd=7
+type=0
+config=8
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS
+[event8:base-stat]
+fd=8
+type=0
+config=1
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_INSTRUCTIONS
+[event9:base-stat]
+fd=9
+type=0
+config=4
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_MISSES
+[event10:base-stat]
+fd=10
+type=0
+config=5
+
+# PERF_TYPE_HW_CACHE /
+# PERF_COUNT_HW_CACHE_L1D << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event11:base-stat]
+fd=11
+type=3
+config=0
+
+# PERF_TYPE_HW_CACHE /
+# PERF_COUNT_HW_CACHE_L1D << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event12:base-stat]
+fd=12
+type=3
+config=65536
+
+# PERF_TYPE_HW_CACHE /
+# PERF_COUNT_HW_CACHE_LL << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event13:base-stat]
+fd=13
+type=3
+config=2
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_LL << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event14:base-stat]
+fd=14
+type=3
+config=65538
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_L1I << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event15:base-stat]
+fd=15
+type=3
+config=1
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_L1I << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event16:base-stat]
+fd=16
+type=3
+config=65537
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_DTLB << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event17:base-stat]
+fd=17
+type=3
+config=3
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_DTLB << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event18:base-stat]
+fd=18
+type=3
+config=65539
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_ITLB << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event19:base-stat]
+fd=19
+type=3
+config=4
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_ITLB << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event20:base-stat]
+fd=20
+type=3
+config=65540
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_L1D << 0 |
+# (PERF_COUNT_HW_CACHE_OP_PREFETCH << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event21:base-stat]
+fd=21
+type=3
+config=512
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_L1D << 0 |
+# (PERF_COUNT_HW_CACHE_OP_PREFETCH << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event22:base-stat]
+fd=22
+type=3
+config=66048
--
1.7.11.7

Jiri Olsa

unread,
Oct 30, 2012, 6:04:51 PM10/30/12
to linux-...@vger.kernel.org, Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
From: "jo...@redhat.com" <jo...@redhat.com>

Adding test to validate perf_event_attr data for command:
'stat'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/tests/attr/test-stat-default | 64 +++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
create mode 100644 tools/perf/tests/attr/test-stat-default

diff --git a/tools/perf/tests/attr/test-stat-default b/tools/perf/tests/attr/test-stat-default
new file mode 100644
index 0000000..19270f5
--- /dev/null
+++ b/tools/perf/tests/attr/test-stat-default
@@ -0,0 +1,64 @@
+[config]
+command = stat
+args = kill >/dev/null 2>&1
+ret = 1
+
--
1.7.11.7

Jiri Olsa

unread,
Oct 30, 2012, 6:05:12 PM10/30/12
to linux-...@vger.kernel.org, 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 --group -e cycles,instructions'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/tests/attr/test-stat-group | 15 +++++++++++++++
1 file changed, 15 insertions(+)
create mode 100644 tools/perf/tests/attr/test-stat-group

diff --git a/tools/perf/tests/attr/test-stat-group b/tools/perf/tests/attr/test-stat-group
new file mode 100644
index 0000000..fdc1596
--- /dev/null
+++ b/tools/perf/tests/attr/test-stat-group
@@ -0,0 +1,15 @@
+[config]
+command = stat
+args = --group -e cycles,instructions kill >/dev/null 2>&1
+ret = 1
+
+[event-1:base-stat]
+fd=1
+group_fd=-1
+
+[event-2:base-stat]
+fd=2
+group_fd=1
+config=1
+disabled=0
+enable_on_exec=0
--
1.7.11.7

Jiri Olsa

unread,
Oct 30, 2012, 6:05:37 PM10/30/12
to linux-...@vger.kernel.org, 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 -i'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/tests/attr/test-stat-no-inherit | 7 +++++++
1 file changed, 7 insertions(+)
create mode 100644 tools/perf/tests/attr/test-stat-no-inherit

diff --git a/tools/perf/tests/attr/test-stat-no-inherit b/tools/perf/tests/attr/test-stat-no-inherit
new file mode 100644
index 0000000..d54b2a1e
--- /dev/null
+++ b/tools/perf/tests/attr/test-stat-no-inherit
@@ -0,0 +1,7 @@
+[config]
+command = stat
+args = -i -e cycles kill >/dev/null 2>&1
+ret = 1
+
+[event:base-stat]
+inherit=0
--
1.7.11.7

Jiri Olsa

unread,
Oct 30, 2012, 6:06:02 PM10/30/12
to linux-...@vger.kernel.org, Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
From: "jo...@redhat.com" <jo...@redhat.com>

Adding test to validate perf_event_attr data for command:
'record -j any'
'record -j any_call'
'record -j any_ret'
'record -j hv'
'record -j ind_call'
'record -j k'
'record -j u'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/tests/attr/test-record-branch-filter-any | 8 ++++++++
tools/perf/tests/attr/test-record-branch-filter-any_call | 8 ++++++++
tools/perf/tests/attr/test-record-branch-filter-any_ret | 8 ++++++++
tools/perf/tests/attr/test-record-branch-filter-hv | 8 ++++++++
tools/perf/tests/attr/test-record-branch-filter-ind_call | 8 ++++++++
tools/perf/tests/attr/test-record-branch-filter-k | 8 ++++++++
tools/perf/tests/attr/test-record-branch-filter-u | 8 ++++++++
7 files changed, 56 insertions(+)
create mode 100644 tools/perf/tests/attr/test-record-branch-filter-any
create mode 100644 tools/perf/tests/attr/test-record-branch-filter-any_call
create mode 100644 tools/perf/tests/attr/test-record-branch-filter-any_ret
create mode 100644 tools/perf/tests/attr/test-record-branch-filter-hv
create mode 100644 tools/perf/tests/attr/test-record-branch-filter-ind_call
create mode 100644 tools/perf/tests/attr/test-record-branch-filter-k
create mode 100644 tools/perf/tests/attr/test-record-branch-filter-u

diff --git a/tools/perf/tests/attr/test-record-branch-filter-any b/tools/perf/tests/attr/test-record-branch-filter-any
new file mode 100644
index 0000000..915c4df
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-branch-filter-any
@@ -0,0 +1,8 @@
+[config]
+command = record
+args = -j any kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=2311
+branch_sample_type=8
diff --git a/tools/perf/tests/attr/test-record-branch-filter-any_call b/tools/perf/tests/attr/test-record-branch-filter-any_call
new file mode 100644
index 0000000..8708dbd
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-branch-filter-any_call
@@ -0,0 +1,8 @@
+[config]
+command = record
+args = -j any_call kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=2311
+branch_sample_type=16
diff --git a/tools/perf/tests/attr/test-record-branch-filter-any_ret b/tools/perf/tests/attr/test-record-branch-filter-any_ret
new file mode 100644
index 0000000..0d3607a
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-branch-filter-any_ret
@@ -0,0 +1,8 @@
+[config]
+command = record
+args = -j any_ret kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=2311
+branch_sample_type=32
diff --git a/tools/perf/tests/attr/test-record-branch-filter-hv b/tools/perf/tests/attr/test-record-branch-filter-hv
new file mode 100644
index 0000000..f255267
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-branch-filter-hv
@@ -0,0 +1,8 @@
+[config]
+command = record
+args = -j hv kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=2311
+branch_sample_type=8
diff --git a/tools/perf/tests/attr/test-record-branch-filter-ind_call b/tools/perf/tests/attr/test-record-branch-filter-ind_call
new file mode 100644
index 0000000..e862dd1
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-branch-filter-ind_call
@@ -0,0 +1,8 @@
+[config]
+command = record
+args = -j ind_call kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=2311
+branch_sample_type=64
diff --git a/tools/perf/tests/attr/test-record-branch-filter-k b/tools/perf/tests/attr/test-record-branch-filter-k
new file mode 100644
index 0000000..182971e
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-branch-filter-k
@@ -0,0 +1,8 @@
+[config]
+command = record
+args = -j k kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=2311
+branch_sample_type=8
diff --git a/tools/perf/tests/attr/test-record-branch-filter-u b/tools/perf/tests/attr/test-record-branch-filter-u
new file mode 100644
index 0000000..83449ef
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-branch-filter-u
@@ -0,0 +1,8 @@
+[config]
+command = record
+args = -j u kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=2311
+branch_sample_type=8
--
1.7.11.7

Jiri Olsa

unread,
Oct 30, 2012, 6:06:24 PM10/30/12
to linux-...@vger.kernel.org, Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
From: "jo...@redhat.com" <jo...@redhat.com>

Adding test to validate perf_event_attr data for command:
'record -R'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/tests/attr/test-record-raw | 7 +++++++
1 file changed, 7 insertions(+)
create mode 100644 tools/perf/tests/attr/test-record-raw

diff --git a/tools/perf/tests/attr/test-record-raw b/tools/perf/tests/attr/test-record-raw
new file mode 100644
index 0000000..4a8ef25
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-raw
@@ -0,0 +1,7 @@
+[config]
+command = record
+args = -R kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=1415
--
1.7.11.7

Jiri Olsa

unread,
Oct 30, 2012, 6:06:45 PM10/30/12
to linux-...@vger.kernel.org, Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
From: "jo...@redhat.com" <jo...@redhat.com>

Adding test to validate perf_event_attr data for command:
'record -D'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/tests/attr/test-record-no-delay | 9 +++++++++
1 file changed, 9 insertions(+)
create mode 100644 tools/perf/tests/attr/test-record-no-delay

diff --git a/tools/perf/tests/attr/test-record-no-delay b/tools/perf/tests/attr/test-record-no-delay
new file mode 100644
index 0000000..f253b78
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-no-delay
@@ -0,0 +1,9 @@
+[config]
+command = record
+args = -D kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=263
+watermark=0
+wakeup_events=1
--
1.7.11.7

Jiri Olsa

unread,
Oct 30, 2012, 6:07:13 PM10/30/12
to linux-...@vger.kernel.org, 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:
'record -c 100 -P'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/tests/attr/test-record-period | 7 +++++++
1 file changed, 7 insertions(+)
create mode 100644 tools/perf/tests/attr/test-record-period

diff --git a/tools/perf/tests/attr/test-record-period b/tools/perf/tests/attr/test-record-period
new file mode 100644
index 0000000..8abc531
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-period
@@ -0,0 +1,7 @@
+[config]
+command = record
+args = -c 100 -P kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=100
+freq=0
--
1.7.11.7

Jiri Olsa

unread,
Oct 30, 2012, 6:07:50 PM10/30/12
to linux-...@vger.kernel.org, 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:
'record -n'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/tests/attr/test-record-no-samples | 6 ++++++
1 file changed, 6 insertions(+)
create mode 100644 tools/perf/tests/attr/test-record-no-samples

diff --git a/tools/perf/tests/attr/test-record-no-samples b/tools/perf/tests/attr/test-record-no-samples
new file mode 100644
index 0000000..d0141b2
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-no-samples
@@ -0,0 +1,6 @@
+[config]
+command = record
+args = -n kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=0
--
1.7.11.7

Jiri Olsa

unread,
Oct 30, 2012, 6:07:59 PM10/30/12
to linux-...@vger.kernel.org, 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:
'record'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/tests/attr/base-record | 40 +++++++++++++++++++++++++++++++++
tools/perf/tests/attr/test-record-basic | 5 +++++
2 files changed, 45 insertions(+)
create mode 100644 tools/perf/tests/attr/base-record
create mode 100644 tools/perf/tests/attr/test-record-basic

diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
new file mode 100644
index 0000000..07beef5
--- /dev/null
+++ b/tools/perf/tests/attr/base-record
@@ -0,0 +1,40 @@
+[event]
+fd=1
+group_fd=-1
+flags=0
+type=0|1
+size=96
+config=0
+sample_period=4000
+sample_type=263
+read_format=7
+disabled=1
+inherit=1
+pinned=0
+exclusive=0
+exclude_user=0
+exclude_kernel=0
+exclude_hv=0
+exclude_idle=0
+mmap=1
+comm=1
+freq=1
+inherit_stat=0
+enable_on_exec=1
+task=0
+watermask=0
+precise_ip=0
+mmap_data=0
+sample_id_all=1
+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-record-basic b/tools/perf/tests/attr/test-record-basic
new file mode 100644
index 0000000..55c0428
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-basic
@@ -0,0 +1,5 @@
+[config]
+command = record
+args = kill >/dev/null 2>&1
+
+[event:base-record]
--
1.7.11.7

Jiri Olsa

unread,
Oct 30, 2012, 6:08:46 PM10/30/12
to linux-...@vger.kernel.org, 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:
'record --group -e cycles,instructions'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/tests/attr/test-record-group | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
create mode 100644 tools/perf/tests/attr/test-record-group

diff --git a/tools/perf/tests/attr/test-record-group b/tools/perf/tests/attr/test-record-group
new file mode 100644
index 0000000..b945f77
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-group
@@ -0,0 +1,17 @@
+[config]
+command = record
+args = --group -e cycles,instructions kill >/dev/null 2>&1
+
+[event-1:base-record]
+fd=1
+group_fd=-1
+sample_type=327
+
+[event-2:base-record]
+fd=2
+group_fd=1
+config=1
+sample_type=327
+mmap=0
+comm=0
+enable_on_exec=0
--
1.7.11.7

Jiri Olsa

unread,
Oct 30, 2012, 6:08:57 PM10/30/12
to linux-...@vger.kernel.org, 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:
'record -F 100'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/tests/attr/test-record-freq | 6 ++++++
1 file changed, 6 insertions(+)
create mode 100644 tools/perf/tests/attr/test-record-freq

diff --git a/tools/perf/tests/attr/test-record-freq b/tools/perf/tests/attr/test-record-freq
new file mode 100644
index 0000000..600d0f8
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-freq
@@ -0,0 +1,6 @@
+[config]
+command = record
+args = -F 100 kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=100
--
1.7.11.7

Jiri Olsa

unread,
Oct 30, 2012, 6:09:49 PM10/30/12
to linux-...@vger.kernel.org, Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
Adding automated test to check event's perf_event_attr values.

The idea is run perf session with kidnapping sys_perf_event_open
function. For each sys_perf_event_open call we store the
perf_event_attr data to the file to be checked later against what
we expect.

You can run this by:
$ python ./tests/attr.py -d ./tests/attr/ -p ./perf -v

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/Makefile | 1 +
tools/perf/perf.c | 2 +
tools/perf/perf.h | 16 ++-
tools/perf/tests/attr.c | 136 ++++++++++++++++++++
tools/perf/tests/attr.py | 313 +++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 466 insertions(+), 2 deletions(-)
create mode 100644 tools/perf/tests/attr.c
create mode 100644 tools/perf/tests/attr.py

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 2d3427f..1da87a3 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -430,6 +430,7 @@ LIB_OBJS += $(OUTPUT)arch/common.o

LIB_OBJS += $(OUTPUT)tests/parse-events.o
LIB_OBJS += $(OUTPUT)tests/dso-data.o
+LIB_OBJS += $(OUTPUT)tests/attr.o

BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index e968373..a0ae290 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -484,6 +484,8 @@ int main(int argc, const char **argv)
}
cmd = argv[0];

+ test_attr__init();
+
/*
* We use PATH to find perf commands, but we prepend some higher
* precedence paths: the "--exec-path" option, the PERF_EXEC_PATH
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 469fbf2..0047264 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -174,13 +174,25 @@ static inline unsigned long long rdclock(void)
(void) (&_min1 == &_min2); \
_min1 < _min2 ? _min1 : _min2; })

+extern bool test_attr__enabled;
+void test_attr__init(void);
+void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
+ int fd, int group_fd, unsigned long flags);
+
static inline int
sys_perf_event_open(struct perf_event_attr *attr,
pid_t pid, int cpu, int group_fd,
unsigned long flags)
{
- return syscall(__NR_perf_event_open, attr, pid, cpu,
- group_fd, flags);
+ int fd;
+
+ fd = syscall(__NR_perf_event_open, attr, pid, cpu,
+ group_fd, flags);
+
+ if (unlikely(test_attr__enabled))
+ test_attr__open(attr, pid, cpu, fd, group_fd, flags);
+
+ return fd;
}

#define MAX_COUNTERS 256
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
new file mode 100644
index 0000000..2fe8cae
--- /dev/null
+++ b/tools/perf/tests/attr.c
@@ -0,0 +1,136 @@
+
+/*
+ * The struct perf_event_attr test support.
+ *
+ * This test is embedded inside into perf directly and is governed
+ * by the PERF_TEST_ATTR environment variable and hook inside
+ * sys_perf_event_open function.
+ *
+ * The general idea is to store 'struct perf_event_attr' details for
+ * each event created within single perf command. Each event details
+ * are stored into separate text file. Once perf command is finished
+ * these files can be checked for values we expect for command.
+ *
+ * Besides 'struct perf_event_attr' values we also store 'fd' and
+ * 'group_fd' values to allow checking for groups created.
+ *
+ * This all is triggered by setting PERF_TEST_ATTR environment variable.
+ * It must contain name of existing directory with access and write
+ * permissions. All the event text files are stored there.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <inttypes.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include "../perf.h"
+#include "util.h"
+
+#define ENV "PERF_TEST_ATTR"
+
+bool test_attr__enabled;
+
+static char *dir;
+
+void test_attr__init(void)
+{
+ dir = getenv(ENV);
+ test_attr__enabled = (dir != NULL);
+}
+
+#define BUFSIZE 1024
+
+#define WRITE_ASS(str, fmt, data) \
+do { \
+ char buf[BUFSIZE]; \
+ size_t size; \
+ \
+ size = snprintf(buf, BUFSIZE, #str "=%"fmt "\n", data); \
+ if (1 != fwrite(buf, size, 1, file)) { \
+ perror("test attr - failed to write event file"); \
+ fclose(file); \
+ return -1; \
+ } \
+ \
+} while (0)
+
+static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,
+ int fd, int group_fd, unsigned long flags)
+{
+ FILE *file;
+ char path[PATH_MAX];
+
+ snprintf(path, PATH_MAX, "%s/event-%d-%llu-%d", dir,
+ attr->type, attr->config, fd);
+
+ file = fopen(path, "w+");
+ if (!file) {
+ perror("test attr - failed to open event file");
+ return -1;
+ }
+
+ if (fprintf(file, "[event-%d-%llu-%d]\n",
+ attr->type, attr->config, fd) < 0) {
+ perror("test attr - failed to write event file");
+ fclose(file);
+ return -1;
+ }
+
+ /* 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);
+
+ /* 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);
+
+ fclose(file);
+ return 0;
+}
+
+void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
+ int fd, int group_fd, unsigned long flags)
+{
+ if (store_event(attr, pid, cpu, fd, group_fd, flags))
+ die("test attr FAILED");
+}
diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py
new file mode 100644
index 0000000..e98c726
--- /dev/null
+++ b/tools/perf/tests/attr.py
@@ -0,0 +1,313 @@
+#! /usr/bin/python
+
+import os
+import sys
+import glob
+import optparse
+import tempfile
+import logging
+import shutil
+import ConfigParser
+
+class Fail(Exception):
+ def __init__(self, test, msg):
+ self.msg = msg
+ self.test = test
+ def getMsg(self):
+ return '\'%s\' - %s' % (self.test.path, self.msg)
+
+class Unsup(Exception):
+ def __init__(self, test):
+ self.test = test
+ def getMsg(self):
+ return '\'%s\'' % self.test.path
+
+class Event(dict):
+ terms = [
+ 'flags',
+ 'type',
+ 'size',
+ 'config',
+ 'sample_period',
+ 'sample_type',
+ 'read_format',
+ 'disabled',
+ 'inherit',
+ 'pinned',
+ 'exclusive',
+ 'exclude_user',
+ 'exclude_kernel',
+ 'exclude_hv',
+ 'exclude_idle',
+ 'mmap',
+ 'comm',
+ 'freq',
+ 'inherit_stat',
+ 'enable_on_exec',
+ 'task',
+ 'watermask',
+ 'precise_ip',
+ 'mmap_data',
+ 'sample_id_all',
+ 'exclude_host',
+ 'exclude_guest',
+ 'exclude_callchain_kernel',
+ 'exclude_callchain_user',
+ 'wakeup_events',
+ 'bp_type',
+ 'config1',
+ 'config2',
+ 'branch_sample_type',
+ 'sample_regs_user',
+ 'sample_stack_user',
+ ]
+
+ def add(self, data):
+ for key, val in data:
+ log.debug(" %s = %s" % (key, val))
+ self[key] = val
+
+ def __init__(self, name, data, base):
+ log.info(" Event %s" % name);
+ self.name = name;
+ self.group = ''
+ self.add(base)
+ self.add(data)
+
+ def compare_data(self, a, b):
+ a_list = a.split('|')
+ b_list = b.split('|')
+
+ for a_item in a_list:
+ for b_item in b_list:
+ if (a_item == b_item):
+ return True
+ elif (a_item == '*') or (b_item == '*'):
+ return True
+
+ return False
+
+ def equal(self, other):
+ for t in Event.terms:
+ log.debug(" [%s] %s %s" % (t, self[t], other[t]));
+ if not self.has_key(t) or not other.has_key(t):
+ return False
+ if not self.compare_data(self[t], other[t]):
+ return False
+ return True
+
+ def is_optional(self):
+ if self['optional'] == '1':
+ return True
+ else:
+ return False
+
+class Test(object):
+ def __init__(self, path, options):
+ parser = ConfigParser.SafeConfigParser()
+ parser.read(path)
+
+ log.warning("running '%s'" % path)
+
+ self.path = path
+ self.test_dir = options.test_dir
+ self.perf = options.perf
+ self.command = parser.get('config', 'command')
+ self.args = parser.get('config', 'args')
+
+ try:
+ self.ret = parser.get('config', 'ret')
+ except:
+ self.ret = 0
+
+ self.expect = {}
+ self.result = {}
+ log.info(" loading expected events");
+ self.load_events(path, self.expect)
+
+ def is_event(self, name):
+ if name.find("event") == -1:
+ return False
+ else:
+ return True
+
+ def load_events(self, path, events):
+ parser_event = ConfigParser.SafeConfigParser()
+ parser_event.read(path)
+
+ for section in filter(self.is_event, parser_event.sections()):
+
+ parser_items = parser_event.items(section);
+ base_items = {}
+
+ if (':' in section):
+ base = section[section.index(':') + 1:]
+ parser_base = ConfigParser.SafeConfigParser()
+ parser_base.read(self.test_dir + '/' + base)
+ base_items = parser_base.items('event')
+
+ e = Event(section, parser_items, base_items)
+ events[section] = e
+
+ def run_cmd(self, tempdir):
+ cmd = "PERF_TEST_ATTR=%s %s %s -o %s/perf.data %s" % (tempdir,
+ self.perf, self.command, tempdir, self.args)
+ ret = os.WEXITSTATUS(os.system(cmd))
+
+ log.info(" running '%s' ret %d " % (cmd, ret))
+
+ if ret != int(self.ret):
+ raise Unsup(self)
+
+ def compare(self, expect, result):
+ match = {}
+
+ log.info(" compare");
+
+ # For each expected event find all matching
+ # events in result. Fail if there's not any.
+ for exp_name, exp_event in expect.items():
+ exp_list = []
+ log.debug(" matching [%s]" % exp_name)
+ for res_name, res_event in result.items():
+ log.debug(" to [%s]" % res_name)
+ if (exp_event.equal(res_event)):
+ exp_list.append(res_name)
+ log.debug(" ->OK")
+ else:
+ log.debug(" ->FAIL");
+
+ log.info(" match: [%s] optional(%d) matches %s" %
+ (exp_name, exp_event.is_optional(), str(exp_list)))
+
+ # we did not any matching event - fail
+ if (not exp_list) and (not exp_event.is_optional()):
+ raise Fail(self, 'match failure');
+
+ match[exp_name] = exp_list
+
+ # For each defined group in the expected events
+ # check we match the same group in the result.
+ for exp_name, exp_event in expect.items():
+ group = exp_event.group
+
+ 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]:
+ raise Fail(self, 'group failure')
+
+ log.info(" group: [%s] matches group leader %s" %
+ (exp_name, str(match[group])))
+
+ log.info(" matched")
+
+ def resolve_groups(self, events):
+ for name, event in events.items():
+ group_fd = event['group_fd'];
+ if group_fd == '-1':
+ continue;
+
+ for iname, ievent in events.items():
+ if (ievent['fd'] == group_fd):
+ event.group = iname
+ log.debug('[%s] has group leader [%s]' % (name, iname))
+ break;
+
+ def run(self):
+ tempdir = tempfile.mkdtemp();
+
+ # run the test script
+ self.run_cmd(tempdir);
+
+ # load events expectation for the test
+ log.info(" loading result events");
+ for f in glob.glob(tempdir + '/event*'):
+ self.load_events(f, self.result);
+
+ # resolve group_fd to event names
+ self.resolve_groups(self.expect);
+ self.resolve_groups(self.result);
+
+ # do the expectation - results matching - both ways
+ self.compare(self.expect, self.result)
+ self.compare(self.result, self.expect)
+
+ # cleanup
+ shutil.rmtree(tempdir)
+
+
+def run_tests(options):
+ for f in glob.glob(options.test_dir + '/' + options.test):
+ try:
+ Test(f, options).run()
+ except Unsup, obj:
+ log.warning("unsupp %s" % obj.getMsg())
+
+def setup_log(verbose):
+ global log
+ level = logging.CRITICAL
+
+ if verbose == 1:
+ level = logging.WARNING
+ if verbose == 2:
+ level = logging.INFO
+ if verbose >= 3:
+ level = logging.DEBUG
+
+ log = logging.getLogger('test')
+ log.setLevel(level)
+ ch = logging.StreamHandler()
+ ch.setLevel(level)
+ formatter = logging.Formatter('%(message)s')
+ ch.setFormatter(formatter)
+ log.addHandler(ch)
+
+USAGE = '''%s [OPTIONS]
+ -d dir # tests dir
+ -p path # perf binary
+ -t test # single test
+ -v # verbose level
+''' % sys.argv[0]
+
+def main():
+ parser = optparse.OptionParser(usage=USAGE)
+
+ parser.add_option("-t", "--test",
+ action="store", type="string", dest="test")
+ parser.add_option("-d", "--test-dir",
+ action="store", type="string", dest="test_dir")
+ parser.add_option("-p", "--perf",
+ action="store", type="string", dest="perf")
+ parser.add_option("-v", "--verbose",
+ action="count", dest="verbose")
+
+ options, args = parser.parse_args()
+ if args:
+ parser.error('FAILED wrong arguments %s' % ' '.join(args))
+ return -1
+
+ setup_log(options.verbose)
+
+ if not options.test_dir:
+ print 'FAILED no -d option specified'
+ sys.exit(-1)
+
+ if not options.test:
+ options.test = 'test*'
+
+ try:
+ run_tests(options)
+
+ except Fail, obj:
+ print "FAILED %s" % obj.getMsg();
+ sys.exit(-1)
+
+ sys.exit(0)
+
+if __name__ == '__main__':
+ main()
--
1.7.11.7

Jiri Olsa

unread,
Oct 30, 2012, 7:01:53 PM10/30/12
to linux-...@vger.kernel.org, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
SNIP

> +
> +void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
> + int fd, int group_fd, unsigned long flags)
> +{
> + if (store_event(attr, pid, cpu, fd, group_fd, flags))
> + die("test attr FAILED");
> +}

ahh crap, I forgot the errno value preservation fix..

I'd send it later with another fix I have for perf stat or v2 if needed ;-)

jirka

Arnaldo Carvalho de Melo

unread,
Oct 31, 2012, 10:26:21 AM10/31/12
to Jiri Olsa, linux-...@vger.kernel.org, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
Em Wed, Oct 31, 2012 at 12:01:20AM +0100, Jiri Olsa escreveu:
> On Tue, Oct 30, 2012 at 11:01:44PM +0100, Jiri Olsa wrote:
> > Adding automated test to check event's perf_event_attr values.
>
> SNIP
>
> > +
> > +void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
> > + int fd, int group_fd, unsigned long flags)
> > +{
> > + if (store_event(attr, pid, cpu, fd, group_fd, flags))
> > + die("test attr FAILED");
> > +}
>
> ahh crap, I forgot the errno value preservation fix..
>
> I'd send it later with another fix I have for perf stat or v2 if needed ;-)

Send just a v2 for this specific patch.

- Arnaldo

Jiri Olsa

unread,
Oct 31, 2012, 10:55:16 AM10/31/12
to Arnaldo Carvalho de Melo, linux-...@vger.kernel.org, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
On Wed, Oct 31, 2012 at 07:26:00AM -0700, Arnaldo Carvalho de Melo wrote:
> Em Wed, Oct 31, 2012 at 12:01:20AM +0100, Jiri Olsa escreveu:
> > On Tue, Oct 30, 2012 at 11:01:44PM +0100, Jiri Olsa wrote:
> > > Adding automated test to check event's perf_event_attr values.
> >
> > SNIP
> >
> > > +
> > > +void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
> > > + int fd, int group_fd, unsigned long flags)
> > > +{
> > > + if (store_event(attr, pid, cpu, fd, group_fd, flags))
> > > + die("test attr FAILED");
> > > +}
> >
> > ahh crap, I forgot the errno value preservation fix..
> >
> > I'd send it later with another fix I have for perf stat or v2 if needed ;-)
>
> Send just a v2 for this specific patch.

attached, might cause some hunks moving a little in
perf tests: Add attr tests under builtin test command

but should be no problem..

whole v2 patchset available here:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/linux.git
perf/test5

thanks,
jirka


---
Adding automated test to check event's perf_event_attr values.

The idea is run perf session with kidnapping sys_perf_event_open
function. For each sys_perf_event_open call we store the
perf_event_attr data to the file to be checked later against what
we expect.

You can run this by:
$ python ./tests/attr.py -d ./tests/attr/ -p ./perf -v

v2 changes:
- preserve errno value in the hook

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
---
tools/perf/Makefile | 1 +
tools/perf/perf.c | 2 +
tools/perf/perf.h | 16 ++-
tools/perf/tests/attr.c | 140 +++++++++++++++++++++
tools/perf/tests/attr.py | 313 +++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 470 insertions(+), 2 deletions(-)
+void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
+ int fd, int group_fd, unsigned long flags);
+
static inline int
sys_perf_event_open(struct perf_event_attr *attr,
pid_t pid, int cpu, int group_fd,
unsigned long flags)
{
- return syscall(__NR_perf_event_open, attr, pid, cpu,
- group_fd, flags);
+ int fd;
+
+ fd = syscall(__NR_perf_event_open, attr, pid, cpu,
+ group_fd, flags);
+
+ if (unlikely(test_attr__enabled))
+ test_attr__open(attr, pid, cpu, fd, group_fd, flags);
+
+ return fd;
}

#define MAX_COUNTERS 256
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
new file mode 100644
index 0000000..55e9a87
--- /dev/null
+++ b/tools/perf/tests/attr.c
@@ -0,0 +1,140 @@
+static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,
+ int fd, int group_fd, unsigned long flags)
+{
+
+void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
+ int fd, int group_fd, unsigned long flags)
+{
+ int errno_saved = errno;
+
+ if (store_event(attr, pid, cpu, fd, group_fd, flags))
+ die("test attr FAILED");
+
+ errno = errno_saved;

Arnaldo Carvalho de Melo

unread,
Nov 1, 2012, 4:38:19 PM11/1/12
to Jiri Olsa, linux-...@vger.kernel.org, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
Em Tue, Oct 30, 2012 at 11:01:41PM +0100, Jiri Olsa escreveu:
> hi,
> this code tests the link between perf stat/record command line
> options and final perf_event_attr struct values. Also it tests
> the group fd linkage.
>
> Plus moving test related objects under 'test' directory.

Ok, so I applied this to my local perf/core branch with a few changes,
namely to move 24/25 to after 5/25 so that I could do, for each
subsequent tests:

$ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install
$ perf test -v perf_event_attr

And see if each one passed.

So at the end I changed
/home/acme/libexec/perf-core/tests/attr/base-record flipping
"watermark=0" to "watermark=1" and got:

[root@sandy ~]# perf test perf_event_attr
13: struct perf_event_attr setup :FAILED '/home/acme/libexec/perf-core/tests/attr/test-record-count' - match failure
FAILED!
[root@sandy ~]#

But I wanted it to show _what_ didn't match, so I tried:

[root@sandy ~]# perf test -v perf_event_attr
13: struct perf_event_attr setup :
--- start ---
running '/home/acme/libexec/perf-core/tests/attr/test-record-count'
FAILED '/home/acme/libexec/perf-core/tests/attr/test-record-count' - match failure
---- end ----
struct perf_event_attr setup: FAILED!
[root@sandy ~]#

Also is there a strict need for setting PERF_TEST_ATTR? I thought that if it
found the /home/acme/libexec/perf-core/tests/attr/ dirs it would test it, but
haven't dug deep, care to ellaborate here?

Ah, I just pushed perf/core with this patchset, thanks!

- Arnaldo

Jiri Olsa

unread,
Nov 1, 2012, 7:22:02 PM11/1/12
to Arnaldo Carvalho de Melo, linux-...@vger.kernel.org, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
yep, you'd need to run:
python ./tests/attr.py -d ./tests/attr/ -p ./perf -t test-record-count -vvv

to see what really did not match

'perf test attr' takes just single -v option into account

could be changed ;)

>
> Also is there a strict need for setting PERF_TEST_ATTR? I thought that if it
> found the /home/acme/libexec/perf-core/tests/attr/ dirs it would test it, but
> haven't dug deep, care to ellaborate here?

PERF_TEST_ATTR instructs perf to store each event details into PERF_TEST_ATTR directory

and python script is running 'PERF_TEST_ATTR=/tmp/temp perf ...' to get events


>
> Ah, I just pushed perf/core with this patchset, thanks!

thanks,
jirka

Namhyung Kim

unread,
Nov 1, 2012, 9:25:32 PM11/1/12
to Jiri Olsa, Arnaldo Carvalho de Melo, linux-...@vger.kernel.org, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
Hi,

On Fri, 2 Nov 2012 00:20:56 +0100, Jiri Olsa wrote:
> On Thu, Nov 01, 2012 at 05:38:01PM -0300, Arnaldo Carvalho de Melo wrote:
>> Ah, I just pushed perf/core with this patchset, thanks!
>
> thanks,
> jirka

When using current acme/perf/core, I got this:

namhyung@sejong:perf$ ./perf test -v perf_event_attr
13: struct perf_event_attr setup :
--- start ---
running './tests/attr/test-record-count'
running './tests/attr/test-stat-group1'
Traceback (most recent call last):
File "./tests/attr.py", line 313, in <module>
main()
File "./tests/attr.py", line 304, in main
run_tests(options)
File "./tests/attr.py", line 247, in run_tests
Test(f, options).run()
File "./tests/attr.py", line 126, in __init__
self.load_events(path, self.expect)
File "./tests/attr.py", line 147, in load_events
base_items = parser_base.items('event')
File "/usr/lib64/python2.7/ConfigParser.py", line 642, in items
raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'event'
---- end ----
struct perf_event_attr setup: FAILED!

namhyung@sejong:perf$ cat tests/attr/test-stat-group1
[config]
command = stat
args = -e '{cycles,instructions}' kill >/dev/null 2>&1
ret = 1

[event-1:base-stat]
fd=1
group_fd=-1

[event-2:base-stat]
fd=2
group_fd=1
config=1
# TODO both disabled and enable_on_exec are disabled for --group option,
# enabled otherwise, check why..
disabled=1
enable_on_exec=1


Thanks,
Namhyung

Namhyung Kim

unread,
Nov 1, 2012, 9:49:09 PM11/1/12
to Jiri Olsa, linux-...@vger.kernel.org, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
Hi Jiri,

Despite its way to acme's tree, I'd like to leave a few comments. :)


On Tue, 30 Oct 2012 23:01:43 +0100, Jiri Olsa wrote:
> Separating test objects into 'tests' directory.
>
> Signed-off-by: Jiri Olsa <jo...@redhat.com>
> Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
> Cc: Peter Zijlstra <a.p.zi...@chello.nl>
> Cc: Ingo Molnar <mi...@elte.hu>
> Cc: Paul Mackerras <pau...@samba.org>
> Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
> Cc: Frederic Weisbecker <fwei...@gmail.com>
> ---
> tools/perf/Makefile | 9 +-
> tools/perf/builtin-test.c | 1559 -----------------------------------
> tools/perf/tests/builtin-test.c | 1559 +++++++++++++++++++++++++++++++++++
> tools/perf/tests/dso-data.c | 153 ++++
> tools/perf/tests/parse-events.c | 1116 +++++++++++++++++++++++++
> tools/perf/util/dso-test-data.c | 153 ----
> tools/perf/util/parse-events-test.c | 1116 -------------------------

Looks like it should be considered as renames. Isn't 'git format-patch
-M' working?


> 7 files changed, 2833 insertions(+), 2832 deletions(-)
> delete mode 100644 tools/perf/builtin-test.c
> create mode 100644 tools/perf/tests/builtin-test.c
> create mode 100644 tools/perf/tests/dso-data.c
> create mode 100644 tools/perf/tests/parse-events.c
> delete mode 100644 tools/perf/util/dso-test-data.c
> delete mode 100644 tools/perf/util/parse-events-test.c
>
> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> index 3e807d7..2d3427f 100644
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
> @@ -169,7 +169,7 @@ endif
>
> ### --- END CONFIGURATION SECTION ---
>
> -BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)util -I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
> +BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)util -Iutil -I. -I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE

Hmm.. Do you really want this? AFAIK there're lots of places that
include header files under the util directory and they used relative
path. I don't know how it affects them but at least they can be changed
to use simpler path with this change.


> BASIC_LDFLAGS =
>
> ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
> @@ -371,7 +371,6 @@ LIB_OBJS += $(OUTPUT)util/help.o
> LIB_OBJS += $(OUTPUT)util/levenshtein.o
> LIB_OBJS += $(OUTPUT)util/parse-options.o
> LIB_OBJS += $(OUTPUT)util/parse-events.o
> -LIB_OBJS += $(OUTPUT)util/parse-events-test.o
> LIB_OBJS += $(OUTPUT)util/path.o
> LIB_OBJS += $(OUTPUT)util/rbtree.o
> LIB_OBJS += $(OUTPUT)util/bitmap.o
> @@ -389,7 +388,6 @@ LIB_OBJS += $(OUTPUT)util/sigchain.o
> LIB_OBJS += $(OUTPUT)util/dso.o
> LIB_OBJS += $(OUTPUT)util/symbol.o
> LIB_OBJS += $(OUTPUT)util/symbol-elf.o
> -LIB_OBJS += $(OUTPUT)util/dso-test-data.o
> LIB_OBJS += $(OUTPUT)util/color.o
> LIB_OBJS += $(OUTPUT)util/pager.o
> LIB_OBJS += $(OUTPUT)util/header.o
> @@ -430,6 +428,9 @@ LIB_OBJS += $(OUTPUT)ui/stdio/hist.o
>
> LIB_OBJS += $(OUTPUT)arch/common.o
>
> +LIB_OBJS += $(OUTPUT)tests/parse-events.o
> +LIB_OBJS += $(OUTPUT)tests/dso-data.o
> +

Maybe TEST_OBJS? I guess they don't need to be included in libperf?


> BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
> BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
> # Benchmark modules
> @@ -459,8 +460,8 @@ BUILTIN_OBJS += $(OUTPUT)builtin-probe.o
> BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o
> BUILTIN_OBJS += $(OUTPUT)builtin-lock.o
> BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o
> -BUILTIN_OBJS += $(OUTPUT)builtin-test.o
> BUILTIN_OBJS += $(OUTPUT)builtin-inject.o
> +BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o

Placing builtin command in a different directory looks little bit odd.

Thanks,
Namhyung

Namhyung Kim

unread,
Nov 1, 2012, 10:19:07 PM11/1/12
to Jiri Olsa, Arnaldo Carvalho de Melo, linux-...@vger.kernel.org, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
On Wed, 31 Oct 2012 15:52:47 +0100, Jiri Olsa wrote:
> Adding automated test to check event's perf_event_attr values.
>
It'd better if it has more specific name like 'event-attr' but it'd not
a big deal so no strong objection. :)

>
> BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
> BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
[snip]
> +#define WRITE_ASS(str, fmt, data) \
> +do { \
> + char buf[BUFSIZE]; \
> + size_t size; \
> + \
> + size = snprintf(buf, BUFSIZE, #str "=%"fmt "\n", data); \
> + if (1 != fwrite(buf, size, 1, file)) { \
> + perror("test attr - failed to write event file"); \
> + fclose(file); \
> + return -1; \
> + } \
> + \
> +} while (0)

What is ASS?
How about rename current WRITE_ASS to __WRITE_ASS and create a wrapper
WRITE_ASS like this:

#define WRITE_ASS(field, fmt) __WRITE_ASS(field, fmt, attr->field)

and use __WRITE_ASS for 'optional'.

> +
> + fclose(file);
> + return 0;
> +}
[snip]
> + def compare_data(self, a, b):
> + a_list = a.split('|')
> + b_list = b.split('|')
> +
> + for a_item in a_list:
> + for b_item in b_list:
> + if (a_item == b_item):
> + return True
> + elif (a_item == '*') or (b_item == '*'):
> + return True
> +
> + return False

I think it needs some comments about how it works.

> +
[snip]
> + def load_events(self, path, events):
> + parser_event = ConfigParser.SafeConfigParser()
> + parser_event.read(path)
> +
> + for section in filter(self.is_event, parser_event.sections()):
> +
> + parser_items = parser_event.items(section);
> + base_items = {}
> +
> + if (':' in section):
> + base = section[section.index(':') + 1:]
> + parser_base = ConfigParser.SafeConfigParser()
> + parser_base.read(self.test_dir + '/' + base)
> + base_items = parser_base.items('event')
> +
> + e = Event(section, parser_items, base_items)
> + events[section] = e

And this too. :)

Thanks,
Namhyung

Namhyung Kim

unread,
Nov 1, 2012, 10:23:43 PM11/1/12
to Jiri Olsa, Arnaldo Carvalho de Melo, linux-...@vger.kernel.org, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
On Fri, 02 Nov 2012 10:25:18 +0900, Namhyung Kim wrote:
> namhyung@sejong:perf$ cat tests/attr/test-stat-group1
> [config]
> command = stat
> args = -e '{cycles,instructions}' kill >/dev/null 2>&1
> ret = 1
>
> [event-1:base-stat]
> fd=1
> group_fd=-1
>
> [event-2:base-stat]
> fd=2
> group_fd=1
> config=1
> # TODO both disabled and enable_on_exec are disabled for --group option,
> # enabled otherwise, check why..
> disabled=1
> enable_on_exec=1

Oh I realize that I don't have the base-stat file.

namhyung@sejong:perf$ cat tests/attr/base-stat
cat: tests/attr/base-stat: No such file or directory

Jiri Olsa

unread,
Nov 2, 2012, 6:31:27 AM11/2/12
to Namhyung Kim, linux-...@vger.kernel.org, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
On Fri, Nov 02, 2012 at 10:48:57AM +0900, Namhyung Kim wrote:
> Hi Jiri,
>
> Despite its way to acme's tree, I'd like to leave a few comments. :)
>
>
> On Tue, 30 Oct 2012 23:01:43 +0100, Jiri Olsa wrote:
> > Separating test objects into 'tests' directory.
> >
> > Signed-off-by: Jiri Olsa <jo...@redhat.com>
> > Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
> > Cc: Peter Zijlstra <a.p.zi...@chello.nl>
> > Cc: Ingo Molnar <mi...@elte.hu>
> > Cc: Paul Mackerras <pau...@samba.org>
> > Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
> > Cc: Frederic Weisbecker <fwei...@gmail.com>
> > ---
> > tools/perf/Makefile | 9 +-
> > tools/perf/builtin-test.c | 1559 -----------------------------------
> > tools/perf/tests/builtin-test.c | 1559 +++++++++++++++++++++++++++++++++++
> > tools/perf/tests/dso-data.c | 153 ++++
> > tools/perf/tests/parse-events.c | 1116 +++++++++++++++++++++++++
> > tools/perf/util/dso-test-data.c | 153 ----
> > tools/perf/util/parse-events-test.c | 1116 -------------------------
>
> Looks like it should be considered as renames. Isn't 'git format-patch
> -M' working?

I can see it is.. nice ;) first time I hear about it..

>
>
> > 7 files changed, 2833 insertions(+), 2832 deletions(-)
> > delete mode 100644 tools/perf/builtin-test.c
> > create mode 100644 tools/perf/tests/builtin-test.c
> > create mode 100644 tools/perf/tests/dso-data.c
> > create mode 100644 tools/perf/tests/parse-events.c
> > delete mode 100644 tools/perf/util/dso-test-data.c
> > delete mode 100644 tools/perf/util/parse-events-test.c
> >
> > diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> > index 3e807d7..2d3427f 100644
> > --- a/tools/perf/Makefile
> > +++ b/tools/perf/Makefile
> > @@ -169,7 +169,7 @@ endif
> >
> > ### --- END CONFIGURATION SECTION ---
> >
> > -BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)util -I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
> > +BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)util -Iutil -I. -I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
>
> Hmm.. Do you really want this? AFAIK there're lots of places that
> include header files under the util directory and they used relative
> path. I don't know how it affects them but at least they can be changed
> to use simpler path with this change.

[jolsa@krava perf]$ make O=$PWD/../build/
..
CC /home/jolsa/kernel.org/linux/tools/build/tests/parse-events.o
tests/parse-events.c:2:26: fatal error: parse-events.h: No such file or directory

yes, we could consolidate util includes globaly

>
>
> > BASIC_LDFLAGS =
> >
> > ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
> > @@ -371,7 +371,6 @@ LIB_OBJS += $(OUTPUT)util/help.o
> > LIB_OBJS += $(OUTPUT)util/levenshtein.o
> > LIB_OBJS += $(OUTPUT)util/parse-options.o
> > LIB_OBJS += $(OUTPUT)util/parse-events.o
> > -LIB_OBJS += $(OUTPUT)util/parse-events-test.o
> > LIB_OBJS += $(OUTPUT)util/path.o
> > LIB_OBJS += $(OUTPUT)util/rbtree.o
> > LIB_OBJS += $(OUTPUT)util/bitmap.o
> > @@ -389,7 +388,6 @@ LIB_OBJS += $(OUTPUT)util/sigchain.o
> > LIB_OBJS += $(OUTPUT)util/dso.o
> > LIB_OBJS += $(OUTPUT)util/symbol.o
> > LIB_OBJS += $(OUTPUT)util/symbol-elf.o
> > -LIB_OBJS += $(OUTPUT)util/dso-test-data.o
> > LIB_OBJS += $(OUTPUT)util/color.o
> > LIB_OBJS += $(OUTPUT)util/pager.o
> > LIB_OBJS += $(OUTPUT)util/header.o
> > @@ -430,6 +428,9 @@ LIB_OBJS += $(OUTPUT)ui/stdio/hist.o
> >
> > LIB_OBJS += $(OUTPUT)arch/common.o
> >
> > +LIB_OBJS += $(OUTPUT)tests/parse-events.o
> > +LIB_OBJS += $(OUTPUT)tests/dso-data.o
> > +
>
> Maybe TEST_OBJS? I guess they don't need to be included in libperf?

I guess we could have NO_TESTS Makefile variable to disable tests

and '[x] Tests' directory under make menuconfig ;)

>
>
> > BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
> > BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
> > # Benchmark modules
> > @@ -459,8 +460,8 @@ BUILTIN_OBJS += $(OUTPUT)builtin-probe.o
> > BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o
> > BUILTIN_OBJS += $(OUTPUT)builtin-lock.o
> > BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o
> > -BUILTIN_OBJS += $(OUTPUT)builtin-test.o
> > BUILTIN_OBJS += $(OUTPUT)builtin-inject.o
> > +BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o
>
> Placing builtin command in a different directory looks little bit odd.

well, it's full of tests ;)

maybe we could have those tests placed in separate files and use
builtin-test as runner only

thanks,
jirka

Jiri Olsa

unread,
Nov 2, 2012, 6:41:15 AM11/2/12
to Namhyung Kim, Arnaldo Carvalho de Melo, linux-...@vger.kernel.org, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
On Fri, Nov 02, 2012 at 11:18:56AM +0900, Namhyung Kim wrote:
> On Wed, 31 Oct 2012 15:52:47 +0100, Jiri Olsa wrote:
> > Adding automated test to check event's perf_event_attr values.
> > +#define WRITE_ASS(str, fmt, data) \
> > +do { \
> > + char buf[BUFSIZE]; \
> > + size_t size; \
> > + \
> > + size = snprintf(buf, BUFSIZE, #str "=%"fmt "\n", data); \
> > + if (1 != fwrite(buf, size, 1, file)) { \
> > + perror("test attr - failed to write event file"); \
> > + fclose(file); \
> > + return -1; \
> > + } \
> > + \
> > +} while (0)
>
> What is ASS?

short for assignment

>
> > +
> > +static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,
> > + int fd, int group_fd, unsigned long flags)
> > +{
> > + FILE *file;
> > + char path[PATH_MAX];
> > +

SNIP

> > + 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);
>
> How about rename current WRITE_ASS to __WRITE_ASS and create a wrapper
> WRITE_ASS like this:
>
> #define WRITE_ASS(field, fmt) __WRITE_ASS(field, fmt, attr->field)
>
> and use __WRITE_ASS for 'optional'.

looks ok
ok, will try ;)

thanks,
jirka

Arnaldo Carvalho de Melo

unread,
Nov 5, 2012, 9:29:21 AM11/5/12
to Jiri Olsa, Namhyung Kim, linux-...@vger.kernel.org, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
Em Fri, Nov 02, 2012 at 11:40:52AM +0100, Jiri Olsa escreveu:
> On Fri, Nov 02, 2012 at 11:18:56AM +0900, Namhyung Kim wrote:
> > > + e = Event(section, parser_items, base_items)
> > > + events[section] = e
> >
> > And this too. :)
>
> ok, will try ;)

Can you provide patches on top of what is in perf/core now?

- Arnaldo

Jiri Olsa

unread,
Nov 5, 2012, 9:42:57 AM11/5/12
to Arnaldo Carvalho de Melo, Namhyung Kim, linux-...@vger.kernel.org, Peter Zijlstra, Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker
On Mon, Nov 05, 2012 at 11:29:11AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Nov 02, 2012 at 11:40:52AM +0100, Jiri Olsa escreveu:
> > On Fri, Nov 02, 2012 at 11:18:56AM +0900, Namhyung Kim wrote:
> > > > + e = Event(section, parser_items, base_items)
> > > > + events[section] = e
> > >
> > > And this too. :)
> >
> > ok, will try ;)
>
> Can you provide patches on top of what is in perf/core now?

ok, jirka

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 1:36:36 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: dc53eda5a025f3e7503219477a8aefb8842ed74b
Gitweb: http://git.kernel.org/tip/dc53eda5a025f3e7503219477a8aefb8842ed74b
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:01:42 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Wed, 31 Oct 2012 15:55:11 -0200

perf tools: Remove BINDIR define from exec_cmd.o compilation

It's not needed.

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-2-g...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
tools/perf/Makefile | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index b1801e0..3e807d7 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -893,7 +893,6 @@ $(OUTPUT)%.s: %.S
$(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
'-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \
- '-DBINDIR="$(bindir_relative_SQ)"' \
'-DPREFIX="$(prefix_SQ)"' \
$<

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 1:40:05 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: 945aea220bb8f4bb37950549cc0b93bbec24c460
Gitweb: http://git.kernel.org/tip/945aea220bb8f4bb37950549cc0b93bbec24c460
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:01:43 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Wed, 31 Oct 2012 16:19:19 -0200

perf tests: Move test objects into 'tests' directory

Separating test objects into 'tests' directory.

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-3-g...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
tools/perf/Makefile | 9 +++++----
tools/perf/{ => tests}/builtin-test.c | 8 ++++----
.../{util/dso-test-data.c => tests/dso-data.c} | 0
.../parse-events-test.c => tests/parse-events.c} | 0
4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 3e807d7..2d3427f 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -169,7 +169,7 @@ endif

### --- END CONFIGURATION SECTION ---

-BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)util -I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
+BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)util -Iutil -I. -I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
BASIC_LDFLAGS =

ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
@@ -371,7 +371,6 @@ LIB_OBJS += $(OUTPUT)util/help.o
LIB_OBJS += $(OUTPUT)util/levenshtein.o
LIB_OBJS += $(OUTPUT)util/parse-options.o
LIB_OBJS += $(OUTPUT)util/parse-events.o
-LIB_OBJS += $(OUTPUT)util/parse-events-test.o
LIB_OBJS += $(OUTPUT)util/path.o
LIB_OBJS += $(OUTPUT)util/rbtree.o
LIB_OBJS += $(OUTPUT)util/bitmap.o
@@ -389,7 +388,6 @@ LIB_OBJS += $(OUTPUT)util/sigchain.o
LIB_OBJS += $(OUTPUT)util/dso.o
LIB_OBJS += $(OUTPUT)util/symbol.o
LIB_OBJS += $(OUTPUT)util/symbol-elf.o
-LIB_OBJS += $(OUTPUT)util/dso-test-data.o
LIB_OBJS += $(OUTPUT)util/color.o
LIB_OBJS += $(OUTPUT)util/pager.o
LIB_OBJS += $(OUTPUT)util/header.o
@@ -430,6 +428,9 @@ LIB_OBJS += $(OUTPUT)ui/stdio/hist.o

LIB_OBJS += $(OUTPUT)arch/common.o

+LIB_OBJS += $(OUTPUT)tests/parse-events.o
+LIB_OBJS += $(OUTPUT)tests/dso-data.o
+
BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
# Benchmark modules
@@ -459,8 +460,8 @@ BUILTIN_OBJS += $(OUTPUT)builtin-probe.o
BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o
BUILTIN_OBJS += $(OUTPUT)builtin-lock.o
BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o
-BUILTIN_OBJS += $(OUTPUT)builtin-test.o
BUILTIN_OBJS += $(OUTPUT)builtin-inject.o
+BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o

PERFLIBS = $(LIB_FILE) $(LIBTRACEEVENT)

diff --git a/tools/perf/builtin-test.c b/tools/perf/tests/builtin-test.c
similarity index 99%
rename from tools/perf/builtin-test.c
rename to tools/perf/tests/builtin-test.c
index a04276e..f6c6424 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -318,7 +318,7 @@ static int test__open_syscall_event(void)
nr_open_calls, evsel->counts->cpu[0].val);
goto out_close_fd;
}
-
+
err = 0;
out_close_fd:
perf_evsel__close_fd(evsel, 1, threads->nr);
@@ -1344,8 +1344,8 @@ static int test__syscall_open_tp_fields(void)
perf_evlist__enable(evlist);

/*
- * Generate the event:
- */
+ * Generate the event:
+ */
open(filename, flags);

while (1) {
@@ -1495,7 +1495,7 @@ static int __cmd_test(int argc, const char *argv[])
width = len;
++i;
}
-
+
i = 0;
while (tests[i].func) {
int curr = i++, err;
diff --git a/tools/perf/util/dso-test-data.c b/tools/perf/tests/dso-data.c
similarity index 100%
rename from tools/perf/util/dso-test-data.c
rename to tools/perf/tests/dso-data.c
diff --git a/tools/perf/util/parse-events-test.c b/tools/perf/tests/parse-events.c
similarity index 100%
rename from tools/perf/util/parse-events-test.c
rename to tools/perf/tests/parse-events.c

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 1:43:35 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, ac...@ghostprotocols.net, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: 52502bf201a85b5b51a384037a002d0b39093df0
Gitweb: http://git.kernel.org/tip/52502bf201a85b5b51a384037a002d0b39093df0
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Wed, 31 Oct 2012 15:52:47 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Wed, 31 Oct 2012 16:20:58 -0200

perf tests: Add framework for automated perf_event_attr tests

The idea is run perf session with kidnapping sys_perf_event_open
function. For each sys_perf_event_open call we store the perf_event_attr
data to the file to be checked later against what we expect.

You can run this by:
$ python ./tests/attr.py -d ./tests/attr/ -p ./perf -v

v2 changes:
- preserve errno value in the hook

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <ac...@ghostprotocols.net>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/2012103114...@krava.brq.redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
tools/perf/Makefile | 1 +
tools/perf/perf.c | 2 +
tools/perf/perf.h | 16 ++-
tools/perf/tests/attr.c | 140 +++++++++++++++++++++
tools/perf/tests/attr.py | 313 ++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 470 insertions(+), 2 deletions(-)

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 1:53:16 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: bf779746f928de99eba84de0a72a5bbfa87ca680
Gitweb: http://git.kernel.org/tip/bf779746f928de99eba84de0a72a5bbfa87ca680
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:01:45 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Thu, 1 Nov 2012 17:00:31 -0300

perf tests: Add attr record basic test

Adding test to validate perf_event_attr data for command:
'record'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-5-g...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
tools/perf/tests/attr/base-record | 40 +++++++++++++++++++++++++++++++
tools/perf/tests/attr/test-record-basic | 5 ++++
2 files changed, 45 insertions(+), 0 deletions(-)

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 1:54:33 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: d898b241215daf6f2e654b32ebb8341bffc98cc5
Gitweb: http://git.kernel.org/tip/d898b241215daf6f2e654b32ebb8341bffc98cc5
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:02:05 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Thu, 1 Nov 2012 17:00:40 -0300

perf tests: Add attr tests under builtin test command

The test attr suite is run only if it's run under perf source directory,
or tests are found in installed path.

Otherwise tests are omitted (notification is displayed) and finished as
successful.

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-25-...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
tools/perf/Makefile | 9 +++++++++
tools/perf/perf.h | 1 +
tools/perf/tests/attr.c | 35 +++++++++++++++++++++++++++++++++++
tools/perf/tests/builtin-test.c | 4 ++++
4 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 1da87a3..4ffcd02 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -898,6 +898,11 @@ $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
'-DPREFIX="$(prefix_SQ)"' \
$<

+$(OUTPUT)tests/attr.o: tests/attr.c $(OUTPUT)PERF-CFLAGS
+ $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
+ '-DBINDIR="$(bindir_SQ)"' \
+ $<
+
$(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<

@@ -1062,6 +1067,10 @@ install: all try-install-man
$(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'
$(INSTALL) bash_completion '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
+ $(INSTALL) tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
+ $(INSTALL) tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'

install-python_ext:
$(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 0047264..054182e 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -178,6 +178,7 @@ extern bool test_attr__enabled;
void test_attr__init(void);
void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
int fd, int group_fd, unsigned long flags);
+int test_attr__run(void);

static inline int
sys_perf_event_open(struct perf_event_attr *attr,
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index 55e9a87..aacad82 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -26,9 +26,12 @@
#include <linux/kernel.h>
#include "../perf.h"
#include "util.h"
+#include "exec_cmd.h"

#define ENV "PERF_TEST_ATTR"

+extern int verbose;
+
bool test_attr__enabled;

static char *dir;
@@ -138,3 +141,35 @@ void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,

errno = errno_saved;
}
+
+static int run_dir(const char *d, const char *perf)
+{
+ char cmd[3*PATH_MAX];
+
+ snprintf(cmd, 3*PATH_MAX, "python %s/attr.py -d %s/attr/ -p %s %s",
+ d, d, perf, verbose ? "-v" : "");
+
+ return system(cmd);
+}
+
+int test_attr__run(void)
+{
+ struct stat st;
+ char path_perf[PATH_MAX];
+ char path_dir[PATH_MAX];
+
+ /* First try developement tree tests. */
+ if (!lstat("./tests", &st))
+ return run_dir("./tests", "./perf");
+
+ /* Then installed path. */
+ snprintf(path_dir, PATH_MAX, "%s/tests", perf_exec_path());
+ snprintf(path_perf, PATH_MAX, "%s/perf", BINDIR);
+
+ if (!lstat(path_dir, &st) &&
+ !lstat(path_perf, &st))
+ return run_dir(path_dir, path_perf);
+
+ fprintf(stderr, " (ommitted)");
+ return 0;
+}
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index f6c6424..1aa9e99 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -1455,6 +1455,10 @@ static struct test {
.func = test__syscall_open_tp_fields,
},
{
+ .desc = "struct perf_event_attr setup",
+ .func = test_attr__run,
+ },
+ {
.func = NULL,
},
};

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 1:55:49 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: 4f59de0bc6a545d730c054e765cf3e7de1f3cf4f
Gitweb: http://git.kernel.org/tip/4f59de0bc6a545d730c054e765cf3e7de1f3cf4f
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:01:46 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Thu, 1 Nov 2012 17:06:06 -0300

perf tests: Add attr record group test

Adding test to validate perf_event_attr data for command:
'record --group -e cycles,instructions'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-6-g...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
tools/perf/tests/attr/test-record-group | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/tools/perf/tests/attr/test-record-group b/tools/perf/tests/attr/test-record-group
new file mode 100644
index 0000000..b945f77
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-group
@@ -0,0 +1,17 @@
+[config]
+command = record
+args = --group -e cycles,instructions kill >/dev/null 2>&1
+
+[event-1:base-record]
+fd=1
+group_fd=-1
+sample_type=327
+
+[event-2:base-record]
+fd=2
+group_fd=1
+config=1
+sample_type=327
+mmap=0
+comm=0
+enable_on_exec=0
--

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 1:56:16 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: 76062f61ff934ac9f22183c10494228852d26d47
Gitweb: http://git.kernel.org/tip/76062f61ff934ac9f22183c10494228852d26d47
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:01:47 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Thu, 1 Nov 2012 17:06:48 -0300

perf tests: Add attr record event syntax group test

Adding test to validate perf_event_attr data for command:
'record group -e {cycles,instructions}'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-7-g...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
tools/perf/tests/attr/test-record-group1 | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/tools/perf/tests/attr/test-record-group1 b/tools/perf/tests/attr/test-record-group1
new file mode 100644
index 0000000..39bf860
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-group1
@@ -0,0 +1,20 @@
+[config]
+command = record
+args = -e '{cycles,instructions}' kill >/tmp/krava 2>&1
+
+[event-1:base-record]
+fd=1
+group_fd=-1
+sample_type=327
+
+[event-2:base-record]
+fd=2
+group_fd=1
+type=0
+config=1
+sample_type=327
+mmap=0
+comm=0
+# TODO this is disabled for --group option, enabled otherwise
+# check why..
+enable_on_exec=1

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 1:57:54 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: 44cfcf4cc6bcb67a01046f7f5c88187d1dafa775
Gitweb: http://git.kernel.org/tip/44cfcf4cc6bcb67a01046f7f5c88187d1dafa775
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:01:48 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Thu, 1 Nov 2012 17:07:12 -0300

perf tests: Add attr record freq test

Adding test to validate perf_event_attr data for command:
'record -F 100'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-8-g...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
tools/perf/tests/attr/test-record-freq | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/tools/perf/tests/attr/test-record-freq b/tools/perf/tests/attr/test-record-freq
new file mode 100644
index 0000000..600d0f8
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-freq
@@ -0,0 +1,6 @@
+[config]
+command = record
+args = -F 100 kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=100
--

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 1:58:17 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: a0f25be079ac10631e8e3a84a2fa8fb55c1e2a7f
Gitweb: http://git.kernel.org/tip/a0f25be079ac10631e8e3a84a2fa8fb55c1e2a7f
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:01:49 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Thu, 1 Nov 2012 17:07:48 -0300

perf tests: Add attr record count test

Adding test to validate perf_event_attr data for command:
'record -c 123'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-9-g...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
tools/perf/tests/attr/test-record-count | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/tools/perf/tests/attr/test-record-count b/tools/perf/tests/attr/test-record-count
new file mode 100644
index 0000000..2f841de
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-count
@@ -0,0 +1,8 @@
+[config]
+command = record
+args = -c 123 kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=123
+sample_type=7
+freq=0

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 1:59:16 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: 8b96829468123431f925223f94a62b3372d8fd5e
Gitweb: http://git.kernel.org/tip/8b96829468123431f925223f94a62b3372d8fd5e
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:01:50 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Thu, 1 Nov 2012 17:07:56 -0300

perf tests: Add attr record graph test

Adding tests to validate perf_event_attr data for commands:
'record -g --'
'record -g fp
'record -g dwarf

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-10-...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
tools/perf/tests/attr/test-record-graph-default | 6 ++++++
tools/perf/tests/attr/test-record-graph-dwarf | 10 ++++++++++
tools/perf/tests/attr/test-record-graph-fp | 6 ++++++
3 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/tools/perf/tests/attr/test-record-graph-default b/tools/perf/tests/attr/test-record-graph-default
new file mode 100644
index 0000000..833d184
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-graph-default
@@ -0,0 +1,6 @@
+[config]
+command = record
+args = -g -- kill >/dev/null 2>&1
+
+[event:base-record]
+sample_type=295
diff --git a/tools/perf/tests/attr/test-record-graph-dwarf b/tools/perf/tests/attr/test-record-graph-dwarf
new file mode 100644
index 0000000..e93e082
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-graph-dwarf
@@ -0,0 +1,10 @@
+[config]
+command = record
+args = -g dwarf -- kill >/dev/null 2>&1
+
+[event:base-record]
+sample_type=12583
+exclude_callchain_user=1
+sample_stack_user=8192
+# TODO different for each arch, no support for that now
+sample_regs_user=*
diff --git a/tools/perf/tests/attr/test-record-graph-fp b/tools/perf/tests/attr/test-record-graph-fp
new file mode 100644
index 0000000..7cef374
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-graph-fp
@@ -0,0 +1,6 @@
+[config]
+command = record
+args = -g fp kill >/dev/null 2>&1
+
+[event:base-record]
+sample_type=295

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 2:00:53 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: da98f8df49eb799b37587eb4a13ea7a1a9f9e47c
Gitweb: http://git.kernel.org/tip/da98f8df49eb799b37587eb4a13ea7a1a9f9e47c
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:01:51 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Thu, 1 Nov 2012 17:08:03 -0300

perf tests: Add attr record period test

Adding test to validate perf_event_attr data for command:
'record -c 100 -P'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-11-...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
.../attr/{test-record-freq => test-record-period} | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tools/perf/tests/attr/test-record-freq b/tools/perf/tests/attr/test-record-period
similarity index 57%
copy from tools/perf/tests/attr/test-record-freq
copy to tools/perf/tests/attr/test-record-period
index 600d0f8..8abc531 100644
--- a/tools/perf/tests/attr/test-record-freq
+++ b/tools/perf/tests/attr/test-record-period
@@ -1,6 +1,7 @@
[config]
command = record
-args = -F 100 kill >/dev/null 2>&1
+args = -c 100 -P kill >/dev/null 2>&1

[event:base-record]
sample_period=100
+freq=0

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 2:01:26 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: 55adeee3aaf745cc8b4e7c5976afbab95bde5697
Gitweb: http://git.kernel.org/tip/55adeee3aaf745cc8b4e7c5976afbab95bde5697
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:01:52 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Thu, 1 Nov 2012 17:08:11 -0300

perf tests: Add attr record no samples test

Adding test to validate perf_event_attr data for command:
'record -n'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-12-...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
tools/perf/tests/attr/test-record-no-samples | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/tools/perf/tests/attr/test-record-no-samples b/tools/perf/tests/attr/test-record-no-samples
new file mode 100644
index 0000000..d0141b2
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-no-samples
@@ -0,0 +1,6 @@
+[config]
+command = record
+args = -n kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=0

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 2:02:53 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: 0a3021c56b81eb3202a506e4d85cb8d99052f28f
Gitweb: http://git.kernel.org/tip/0a3021c56b81eb3202a506e4d85cb8d99052f28f
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:01:53 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Thu, 1 Nov 2012 17:08:40 -0300

perf tests: Add attr record no-inherit test

Adding test to validate perf_event_attr data for command:
'record -i'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-13-...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
tools/perf/tests/attr/test-record-no-inherit | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/tools/perf/tests/attr/test-record-no-inherit b/tools/perf/tests/attr/test-record-no-inherit
new file mode 100644
index 0000000..9079a25
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-no-inherit
@@ -0,0 +1,7 @@
+[config]
+command = record
+args = -i kill >/dev/null 2>&1
+
+[event:base-record]
+sample_type=259
+inherit=0

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 2:11:30 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: 23823641ff8415ef500483af06a58069f7470d23
Gitweb: http://git.kernel.org/tip/23823641ff8415ef500483af06a58069f7470d23
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:01:54 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Mon, 5 Nov 2012 14:02:02 -0300

perf tests: Add attr record data test

Adding test to validate perf_event_attr data for command:
'record -d'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Jiri Olsa <jo...@redhat.com>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-14-...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
tools/perf/tests/attr/test-record-data | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/tools/perf/tests/attr/test-record-data b/tools/perf/tests/attr/test-record-data
new file mode 100644
index 0000000..6627c3e
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-data
@@ -0,0 +1,8 @@
+[config]
+command = record
+args = -d kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=271
+mmap_data=1

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 2:12:53 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: 813105858a85c9a98fc686fbe6788dc217cc9ab3
Gitweb: http://git.kernel.org/tip/813105858a85c9a98fc686fbe6788dc217cc9ab3
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:01:55 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Mon, 5 Nov 2012 14:02:07 -0300

perf tests: Add attr record raw test

Adding test to validate perf_event_attr data for command:
'record -R'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Jiri Olsa <jo...@redhat.com>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-15-...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
.../attr/{test-record-data => test-record-raw} | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/perf/tests/attr/test-record-data b/tools/perf/tests/attr/test-record-raw
similarity index 51%
copy from tools/perf/tests/attr/test-record-data
copy to tools/perf/tests/attr/test-record-raw
index 6627c3e..4a8ef25 100644
--- a/tools/perf/tests/attr/test-record-data
+++ b/tools/perf/tests/attr/test-record-raw
@@ -1,8 +1,7 @@
[config]
command = record
-args = -d kill >/dev/null 2>&1
+args = -R kill >/dev/null 2>&1

[event:base-record]
sample_period=4000
-sample_type=271
-mmap_data=1
+sample_type=1415

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 2:13:36 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: f2e264ce36cbac642a63c23725da712bf00d508b
Gitweb: http://git.kernel.org/tip/f2e264ce36cbac642a63c23725da712bf00d508b
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:01:56 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Mon, 5 Nov 2012 14:02:09 -0300

perf tests: Add attr record no delay test

Adding test to validate perf_event_attr data for command:
'record -D'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Jiri Olsa <jo...@redhat.com>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-16-...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
tools/perf/tests/attr/test-record-no-delay | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/tools/perf/tests/attr/test-record-no-delay b/tools/perf/tests/attr/test-record-no-delay
new file mode 100644
index 0000000..f253b78
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-no-delay
@@ -0,0 +1,9 @@
+[config]
+command = record
+args = -D kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=263
+watermark=0
+wakeup_events=1

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 2:14:53 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: 2fa10f2fe370f2da6c48dae5a154bfcd74848538
Gitweb: http://git.kernel.org/tip/2fa10f2fe370f2da6c48dae5a154bfcd74848538
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:01:57 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Mon, 5 Nov 2012 14:02:18 -0300

perf tests: Add attr record branch any test

Adding test to validate perf_event_attr data for command:
'record -b'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Jiri Olsa <jo...@redhat.com>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-17-...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
tools/perf/tests/attr/test-record-branch-any | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/tools/perf/tests/attr/test-record-branch-any b/tools/perf/tests/attr/test-record-branch-any
new file mode 100644
index 0000000..1421960
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-branch-any
@@ -0,0 +1,8 @@
+[config]
+command = record
+args = -b kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=2311
+branch_sample_type=8

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 2:16:23 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: 9c90178412813368b7f040793c4af2fdfed3634d
Gitweb: http://git.kernel.org/tip/9c90178412813368b7f040793c4af2fdfed3634d
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:01:58 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Mon, 5 Nov 2012 14:02:21 -0300

perf tests: Add attr record branch filter tests

Adding test to validate perf_event_attr data for command:
'record -j any'
'record -j any_call'
'record -j any_ret'
'record -j hv'
'record -j ind_call'
'record -j k'
'record -j u'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Jiri Olsa <jo...@redhat.com>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-18-...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
.../perf/tests/attr/test-record-branch-filter-any | 8 ++++++++
.../tests/attr/test-record-branch-filter-any_call | 8 ++++++++
.../tests/attr/test-record-branch-filter-any_ret | 8 ++++++++
tools/perf/tests/attr/test-record-branch-filter-hv | 8 ++++++++
.../tests/attr/test-record-branch-filter-ind_call | 8 ++++++++
tools/perf/tests/attr/test-record-branch-filter-k | 8 ++++++++
tools/perf/tests/attr/test-record-branch-filter-u | 8 ++++++++
7 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/tools/perf/tests/attr/test-record-branch-filter-any b/tools/perf/tests/attr/test-record-branch-filter-any
new file mode 100644
index 0000000..915c4df
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-branch-filter-any
@@ -0,0 +1,8 @@
+[config]
+command = record
+args = -j any kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=2311
+branch_sample_type=8
diff --git a/tools/perf/tests/attr/test-record-branch-filter-any_call b/tools/perf/tests/attr/test-record-branch-filter-any_call
new file mode 100644
index 0000000..8708dbd
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-branch-filter-any_call
@@ -0,0 +1,8 @@
+[config]
+command = record
+args = -j any_call kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=2311
+branch_sample_type=16
diff --git a/tools/perf/tests/attr/test-record-branch-filter-any_ret b/tools/perf/tests/attr/test-record-branch-filter-any_ret
new file mode 100644
index 0000000..0d3607a
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-branch-filter-any_ret
@@ -0,0 +1,8 @@
+[config]
+command = record
+args = -j any_ret kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=2311
+branch_sample_type=32
diff --git a/tools/perf/tests/attr/test-record-branch-filter-hv b/tools/perf/tests/attr/test-record-branch-filter-hv
new file mode 100644
index 0000000..f255267
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-branch-filter-hv
@@ -0,0 +1,8 @@
+[config]
+command = record
+args = -j hv kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=2311
+branch_sample_type=8
diff --git a/tools/perf/tests/attr/test-record-branch-filter-ind_call b/tools/perf/tests/attr/test-record-branch-filter-ind_call
new file mode 100644
index 0000000..e862dd1
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-branch-filter-ind_call
@@ -0,0 +1,8 @@
+[config]
+command = record
+args = -j ind_call kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=2311
+branch_sample_type=64
diff --git a/tools/perf/tests/attr/test-record-branch-filter-k b/tools/perf/tests/attr/test-record-branch-filter-k
new file mode 100644
index 0000000..182971e
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-branch-filter-k
@@ -0,0 +1,8 @@
+[config]
+command = record
+args = -j k kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=2311
+branch_sample_type=8
diff --git a/tools/perf/tests/attr/test-record-branch-filter-u b/tools/perf/tests/attr/test-record-branch-filter-u
new file mode 100644
index 0000000..83449ef
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-branch-filter-u
@@ -0,0 +1,8 @@
+[config]
+command = record
+args = -j u kill >/dev/null 2>&1

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 2:16:28 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: 9602681f705830955eff1c2dd18283e5a01be58c
Gitweb: http://git.kernel.org/tip/9602681f705830955eff1c2dd18283e5a01be58c
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:02:00 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Mon, 5 Nov 2012 14:02:30 -0300

perf tests: Add attr stat no-inherit test

Adding test to validate perf_event_attr data for command:
'stat -i'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-20-...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
tools/perf/tests/attr/test-stat-no-inherit | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/tools/perf/tests/attr/test-stat-no-inherit b/tools/perf/tests/attr/test-stat-no-inherit
new file mode 100644
index 0000000..d54b2a1e
--- /dev/null
+++ b/tools/perf/tests/attr/test-stat-no-inherit
@@ -0,0 +1,7 @@
+[config]
+command = stat
+args = -i -e cycles kill >/dev/null 2>&1
+ret = 1
+
+[event:base-stat]
+inherit=0

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 2:17:37 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: a6d3476c58763b35104d815757faed5bdf040cea
Gitweb: http://git.kernel.org/tip/a6d3476c58763b35104d815757faed5bdf040cea
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:02:01 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Mon, 5 Nov 2012 14:02:37 -0300

perf tests: Add attr stat group test

Adding test to validate perf_event_attr data for command:
'stat --group -e cycles,instructions'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-21-...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
.../attr/{test-record-group => test-stat-group} | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/tools/perf/tests/attr/test-record-group b/tools/perf/tests/attr/test-stat-group
similarity index 55%
copy from tools/perf/tests/attr/test-record-group
copy to tools/perf/tests/attr/test-stat-group
index b945f77..fdc1596 100644
--- a/tools/perf/tests/attr/test-record-group
+++ b/tools/perf/tests/attr/test-stat-group
@@ -1,17 +1,15 @@
[config]
-command = record
+command = stat
args = --group -e cycles,instructions kill >/dev/null 2>&1
+ret = 1

-[event-1:base-record]
+[event-1:base-stat]
fd=1
group_fd=-1
-sample_type=327

-[event-2:base-record]
+[event-2:base-stat]
fd=2
group_fd=1
config=1
-sample_type=327
-mmap=0
-comm=0
+disabled=0
enable_on_exec=0

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 2:18:32 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: 28ae79cfb622cf471d45f1b3f38609d8766e8a95
Gitweb: http://git.kernel.org/tip/28ae79cfb622cf471d45f1b3f38609d8766e8a95
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:02:02 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Mon, 5 Nov 2012 14:03:57 -0300

perf tests: Add attr stat event syntax group test

Adding test to validate perf_event_attr data for command:
'stat -e {cycles,instructions}'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-22-...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
tools/perf/tests/attr/test-stat-group1 | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/tools/perf/tests/attr/test-stat-group1 b/tools/perf/tests/attr/test-stat-group1
new file mode 100644
index 0000000..5ae2718
--- /dev/null
+++ b/tools/perf/tests/attr/test-stat-group1
@@ -0,0 +1,17 @@
+[config]
+command = stat
+args = -e '{cycles,instructions}' kill >/dev/null 2>&1
+ret = 1
+
+[event-1:base-stat]
+fd=1
+group_fd=-1
+
+[event-2:base-stat]
+fd=2
+group_fd=1
+config=1
+# TODO both disabled and enable_on_exec are disabled for --group option,
+# enabled otherwise, check why..
+disabled=1
+enable_on_exec=1

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 2:20:04 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: 149960a0dd4222fbd6678876c005b8b1c85f8e6a
Gitweb: http://git.kernel.org/tip/149960a0dd4222fbd6678876c005b8b1c85f8e6a
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:02:03 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Mon, 5 Nov 2012 14:03:57 -0300

perf tests: Add attr stat default test

Adding test to validate perf_event_attr data for command:
'stat'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Jiri Olsa <jo...@redhat.com>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-23-...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
tools/perf/tests/attr/test-stat-default | 64 +++++++++++++++++++++++++++++++
1 files changed, 64 insertions(+), 0 deletions(-)

diff --git a/tools/perf/tests/attr/test-stat-default b/tools/perf/tests/attr/test-stat-default
new file mode 100644
index 0000000..19270f5
--- /dev/null
+++ b/tools/perf/tests/attr/test-stat-default
@@ -0,0 +1,64 @@
+[config]
+command = stat
+args = kill >/dev/null 2>&1
+ret = 1
+
+# PERF_TYPE_SOFTWARE / PERF_COUNT_SW_TASK_CLOCK
+[event1:base-stat]
+fd=1
+type=1
+config=1
+
+# PERF_TYPE_SOFTWARE / PERF_COUNT_SW_CONTEXT_SWITCHES
+[event2:base-stat]
+fd=2
+type=1
+config=3
+
+# PERF_TYPE_SOFTWARE / PERF_COUNT_SW_CPU_MIGRATIONS
+[event3:base-stat]
+fd=3
+type=1
+config=4
+
+# PERF_TYPE_SOFTWARE / PERF_COUNT_SW_PAGE_FAULTS
+[event4:base-stat]
+fd=4
+type=1
+config=2
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_CPU_CYCLES
+[event5:base-stat]
+fd=5
+type=0
+config=0
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_FRONTEND
+[event6:base-stat]
+fd=6
+type=0
+config=7
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND
+[event7:base-stat]
+fd=7
+type=0
+config=8
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS
+[event8:base-stat]
+fd=8
+type=0
+config=1
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_INSTRUCTIONS
+[event9:base-stat]
+fd=9
+type=0
+config=4
+
+# PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_MISSES
+[event10:base-stat]
+fd=10
+type=0
+config=5

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 2:22:04 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: 8a6408a04bf98c853a047412f20f9c73669058be
Gitweb: http://git.kernel.org/tip/8a6408a04bf98c853a047412f20f9c73669058be
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:02:04 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Mon, 5 Nov 2012 14:03:57 -0300

perf tests: Add attr stat default test

Adding test to validate perf_event_attr data for commands:
'stat -d'
'stat -dd'
'stat -ddd'

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Jiri Olsa <jo...@redhat.com>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-24-...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
.../{test-stat-default => test-stat-detailed-1} | 39 +++++-
tools/perf/tests/attr/test-stat-detailed-2 | 155 ++++++++++++++++++
tools/perf/tests/attr/test-stat-detailed-3 | 173 ++++++++++++++++++++
3 files changed, 366 insertions(+), 1 deletions(-)

diff --git a/tools/perf/tests/attr/test-stat-default b/tools/perf/tests/attr/test-stat-detailed-1
similarity index 51%
copy from tools/perf/tests/attr/test-stat-default
copy to tools/perf/tests/attr/test-stat-detailed-1
index 19270f5..51426b8 100644
--- a/tools/perf/tests/attr/test-stat-default
+++ b/tools/perf/tests/attr/test-stat-detailed-1
@@ -1,8 +1,9 @@
[config]
command = stat
-args = kill >/dev/null 2>&1
+args = -d kill >/dev/null 2>&1
ret = 1

+
# PERF_TYPE_SOFTWARE / PERF_COUNT_SW_TASK_CLOCK
[event1:base-stat]
fd=1
@@ -62,3 +63,39 @@ config=4
fd=10
type=0
config=5
+
+# PERF_TYPE_HW_CACHE /
+# PERF_COUNT_HW_CACHE_L1D << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event11:base-stat]
+fd=11
+type=3
+config=0
+
+# PERF_TYPE_HW_CACHE /
+# PERF_COUNT_HW_CACHE_L1D << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event12:base-stat]
+fd=12
+type=3
+config=65536
+
+# PERF_TYPE_HW_CACHE /
+# PERF_COUNT_HW_CACHE_LL << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event13:base-stat]
+fd=13
+type=3
+config=2
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_LL << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event14:base-stat]
+fd=14
+type=3
+config=65538
diff --git a/tools/perf/tests/attr/test-stat-detailed-2 b/tools/perf/tests/attr/test-stat-detailed-2
new file mode 100644
index 0000000..8de5acc
--- /dev/null
+++ b/tools/perf/tests/attr/test-stat-detailed-2
@@ -0,0 +1,155 @@
+[config]
+command = stat
+args = -dd kill >/dev/null 2>&1
+
+# PERF_TYPE_HW_CACHE /
+# PERF_COUNT_HW_CACHE_L1D << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event11:base-stat]
+fd=11
+type=3
+config=0
+
+# PERF_TYPE_HW_CACHE /
+# PERF_COUNT_HW_CACHE_L1D << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event12:base-stat]
+fd=12
+type=3
+config=65536
+
+# PERF_TYPE_HW_CACHE /
+# PERF_COUNT_HW_CACHE_LL << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event13:base-stat]
+fd=13
+type=3
+config=2
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_LL << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event14:base-stat]
+fd=14
+type=3
+config=65538
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_L1I << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event15:base-stat]
+fd=15
+type=3
+config=1
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_L1I << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event16:base-stat]
+fd=16
+type=3
+config=65537
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_DTLB << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event17:base-stat]
+fd=17
+type=3
+config=3
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_DTLB << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event18:base-stat]
+fd=18
+type=3
+config=65539
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_ITLB << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event19:base-stat]
+fd=19
+type=3
+config=4
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_ITLB << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event20:base-stat]
+fd=20
+type=3
+config=65540
diff --git a/tools/perf/tests/attr/test-stat-detailed-3 b/tools/perf/tests/attr/test-stat-detailed-3
new file mode 100644
index 0000000..0a1f45b
--- /dev/null
+++ b/tools/perf/tests/attr/test-stat-detailed-3
@@ -0,0 +1,173 @@
+[config]
+command = stat
+args = -ddd kill >/dev/null 2>&1
+
+# PERF_TYPE_HW_CACHE /
+# PERF_COUNT_HW_CACHE_L1D << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event11:base-stat]
+fd=11
+type=3
+config=0
+
+# PERF_TYPE_HW_CACHE /
+# PERF_COUNT_HW_CACHE_L1D << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event12:base-stat]
+fd=12
+type=3
+config=65536
+
+# PERF_TYPE_HW_CACHE /
+# PERF_COUNT_HW_CACHE_LL << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event13:base-stat]
+fd=13
+type=3
+config=2
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_LL << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event14:base-stat]
+fd=14
+type=3
+config=65538
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_L1I << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event15:base-stat]
+fd=15
+type=3
+config=1
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_L1I << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event16:base-stat]
+fd=16
+type=3
+config=65537
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_DTLB << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event17:base-stat]
+fd=17
+type=3
+config=3
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_DTLB << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event18:base-stat]
+fd=18
+type=3
+config=65539
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_ITLB << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event19:base-stat]
+fd=19
+type=3
+config=4
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_ITLB << 0 |
+# (PERF_COUNT_HW_CACHE_OP_READ << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event20:base-stat]
+fd=20
+type=3
+config=65540
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_L1D << 0 |
+# (PERF_COUNT_HW_CACHE_OP_PREFETCH << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)
+[event21:base-stat]
+fd=21
+type=3
+config=512
+
+# PERF_TYPE_HW_CACHE,
+# PERF_COUNT_HW_CACHE_L1D << 0 |
+# (PERF_COUNT_HW_CACHE_OP_PREFETCH << 8) |
+# (PERF_COUNT_HW_CACHE_RESULT_MISS << 16)
+[event22:base-stat]
+fd=22
+type=3
+config=66048

tip-bot for Jiri Olsa

unread,
Nov 14, 2012, 2:22:36 AM11/14/12
to linux-ti...@vger.kernel.org, ac...@redhat.com, linux-...@vger.kernel.org, pau...@samba.org, h...@zytor.com, mi...@kernel.org, a.p.zi...@chello.nl, jo...@redhat.com, fwei...@gmail.com, tg...@linutronix.de, cjas...@linux.vnet.ibm.com, mi...@elte.hu
Commit-ID: b84800a31502ab75c0032192de01e61a0d517f38
Gitweb: http://git.kernel.org/tip/b84800a31502ab75c0032192de01e61a0d517f38
Author: Jiri Olsa <jo...@redhat.com>
AuthorDate: Tue, 30 Oct 2012 23:02:06 +0100
Committer: Arnaldo Carvalho de Melo <ac...@redhat.com>
CommitDate: Mon, 5 Nov 2012 14:03:58 -0300

perf tests: Add documentation for attr tests

Adding documentation for attr tests.

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Corey Ashford <cjas...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <a.p.zi...@chello.nl>
Link: http://lkml.kernel.org/r/1351634526-1516-26-...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <ac...@redhat.com>
---
tools/perf/tests/attr/README | 64 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 64 insertions(+), 0 deletions(-)

diff --git a/tools/perf/tests/attr/README b/tools/perf/tests/attr/README
new file mode 100644
index 0000000..d102957
--- /dev/null
+++ b/tools/perf/tests/attr/README
@@ -0,0 +1,64 @@
+The struct perf_event_attr test (attr tests) support
+====================================================
+This testing support is embedded into perf directly and is governed
+by the PERF_TEST_ATTR environment variable and hook inside the
+sys_perf_event_open function.
+
+The general idea is to store 'struct perf_event_attr' details for
+each event created within single perf command. Each event details
+are stored into separate text file. Once perf command is finished
+these files are checked for values we expect for command.
+
+The attr tests consist of following parts:
+
+tests/attr.c
+------------
+This is the sys_perf_event_open hook implementation. The hook
+is triggered when the PERF_TEST_ATTR environment variable is
+defined. It must contain name of existing directory with access
+and write permissions.
+
+For each sys_perf_event_open call event details are stored in
+separate file. Besides 'struct perf_event_attr' values we also
+store 'fd' and 'group_fd' values to allow checking for groups.
+
+tests/attr.py
+-------------
+This is the python script that does all the hard work. It reads
+the test definition, executes it and checks results.
+
+tests/attr/
+-----------
+Directory containing all attr test definitions.
+Following tests are defined (with perf commands):
+
+ perf record kill (test-record-basic)
+ perf record -b kill (test-record-branch-any)
+ perf record -j any kill (test-record-branch-filter-any)
+ perf record -j any_call kill (test-record-branch-filter-any_call)
+ perf record -j any_ret kill (test-record-branch-filter-any_ret)
+ perf record -j hv kill (test-record-branch-filter-hv)
+ perf record -j ind_call kill (test-record-branch-filter-ind_call)
+ perf record -j k kill (test-record-branch-filter-k)
+ perf record -j u kill (test-record-branch-filter-u)
+ perf record -c 123 kill (test-record-count)
+ perf record -d kill (test-record-data)
+ perf record -F 100 kill (test-record-freq)
+ perf record -g -- kill (test-record-graph-default)
+ perf record -g dwarf -- kill (test-record-graph-dwarf)
+ perf record -g fp kill (test-record-graph-fp)
+ perf record --group -e cycles,instructions kill (test-record-group)
+ perf record -e '{cycles,instructions}' kill (test-record-group1)
+ perf record -D kill (test-record-no-delay)
+ perf record -i kill (test-record-no-inherit)
+ perf record -n kill (test-record-no-samples)
+ perf record -c 100 -P kill (test-record-period)
+ perf record -R kill (test-record-raw)
+ perf stat -e cycles kill (test-stat-basic)
+ perf stat kill (test-stat-default)
+ perf stat -d kill (test-stat-detailed-1)
+ perf stat -dd kill (test-stat-detailed-2)
+ perf stat -ddd kill (test-stat-detailed-3)
+ perf stat --group -e cycles,instructions kill (test-stat-group)
+ perf stat -e '{cycles,instructions}' kill (test-stat-group1)
+ perf stat -i -e cycles kill (test-stat-no-inherit)
0 new messages