Skip to contentSkip to conversation

perf test: Add perf_event_attr tests

PATCH In review Jiri Olsa 3 participants 63 messages Oct 30, 2012 – Nov 14, 2012 perf events

lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

cover perf test: Add perf_event_attr tests

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 <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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(-)
author
#1 lore raw

PATCH 1/25 perf tools: Remove BINDIR define from exec_cmd.o compilation

It's not needed.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 tools/perf/Makefile | 1 -
 1 file changed, 1 deletion(-)
tools/perf/Makefile +0 -1
index b1801e0..3e807d7 100644
@@ -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)"' \
 		$<
 
Signature · 1 line
1.7.11.7
#2 lore raw

[tip:perf/core] perf tools: Remove BINDIR define from exec_cmd. o compilation

Commit-ID:  dc53eda5a025f3e7503219477a8aefb8842ed74b
Gitweb:     http://git.kernel.org/tip/dc53eda5a025f3e7503219477a8aefb8842ed74b
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:01:42 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 31 Oct 2012 15:55:11 -0200

perf tools: Remove BINDIR define from exec_cmd.o compilation

It's not needed.

---
 tools/perf/Makefile |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
tools/perf/Makefile +0 -1
index b1801e0..3e807d7 100644
@@ -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)"' \
 		$<
 
author
#3 lore raw

PATCH 2/25 perf tests: Move test objects into 'tests' directory

In reply to Jiri Olsa

Separating test objects into 'tests' directory.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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 -------------------------
 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
tools/perf/Makefile +5 -4
index 3e807d7..2d3427f 100644
@@ -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)
 
tools/perf/builtin-test.c deleted +0 -1559

1,559 lines not on this page · raw message

tools/perf/tests/builtin-test.c new file +1559 -0

1,401 lines not on this page · raw message

tools/perf/tests/dso-data.c new file +153 -0

153 lines not on this page · raw message

tools/perf/tests/parse-events.c new file +1116 -0

1,116 lines not on this page · raw message

tools/perf/util/dso-test-data.c deleted +0 -153

153 lines not on this page · raw message

tools/perf/util/parse-events-test.c deleted +0 -1116

1,116 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.11.7

Part of the diff is not shown here. View the raw message.

maintainer
#4 lore raw

Re: [PATCH 02/25] perf tests: Move test objects into 'tests' directory

Hi Jiri,

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

Quoted 9 lines · Jiri Olsa

Separating test objects into 'tests' directory.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Quoted 8 lines
---
 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?

Quoted 13 lines
 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
tools/perf/Makefile +0 -0
index 3e807d7..2d3427f 100644

tools/perf/Makefile endif · line 172

Quoted 5 lines
tools/perf/Makefile +1 -1
@@ -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.

Quoted 20 lines
tools/perf/Makefile +0 -2
 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

tools/perf/Makefile LIB_OBJS += $(OUTPUT)ui/stdio/hist.o · line 433

Quoted 6 lines
tools/perf/Makefile +3 -0
@@ -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?

tools/perf/Makefile BUILTIN_OBJS += $(OUTPUT)builtin-probe.o · line 464

Quoted 10 lines
tools/perf/Makefile +1 -1
 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

author
#5 lore raw

Re: [PATCH 02/25] perf tests: Move test objects into 'tests' directory

Quoted 24 lines · Namhyung Kim

Hi Jiri,

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

Quoted 9 lines · Jiri Olsa

Separating test objects into 'tests' directory.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Quoted 8 lines
---
 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 -------------------------
Quoted 2 lines

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..

Quoted 18 lines
Quoted 18 lines

 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
tools/perf/Makefile +0 -0
index 3e807d7..2d3427f 100644
@@ -169,7 +169,7 @@ endif
 
 ### --- END CONFIGURATION SECTION ---
 
Quoted 7 lines

tools/perf/Makefile endif · line 172

Quoted 2 lines
tools/perf/Makefile +1 -1
-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

Quoted 23 lines
Quoted 23 lines
tools/perf/Makefile +0 -2
 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
 
Quoted 7 lines

tools/perf/Makefile LIB_OBJS += $(OUTPUT)ui/stdio/hist.o · line 433

Quoted 5 lines
tools/perf/Makefile +3 -0
 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 ;)

Quoted 14 lines

tools/perf/Makefile BUILTIN_OBJS += $(OUTPUT)builtin-probe.o · line 464

Quoted 12 lines
tools/perf/Makefile +1 -1
 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

#6 lore raw

[tip:perf/core] perf tests: Move test objects into 'tests' directory

In reply to Jiri Olsa
Commit-ID:  945aea220bb8f4bb37950549cc0b93bbec24c460
Gitweb:     http://git.kernel.org/tip/945aea220bb8f4bb37950549cc0b93bbec24c460
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:01:43 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 31 Oct 2012 16:19:19 -0200

perf tests: Move test objects into 'tests' directory

Separating test objects into 'tests' directory.

---
 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(-)
tools/perf/Makefile +5 -4
index 3e807d7..2d3427f 100644
@@ -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)
 
tools/perf/tests/builtin-test.c renamed from tools/perf/builtin-test.c +4 -4
similarity index 99%
rename from tools/perf/builtin-test.c
rename to tools/perf/tests/builtin-test.c
index a04276e..f6c6424 100644
@@ -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;
tools/perf/tests/dso-data.c renamed from tools/perf/util/dso-test-data.c +0 -0
similarity index 100%
rename from tools/perf/util/dso-test-data.c
rename to tools/perf/tests/dso-data.c
tools/perf/tests/parse-events.c renamed from tools/perf/util/parse-events-test.c +0 -0
similarity index 100%
rename from tools/perf/util/parse-events-test.c
rename to tools/perf/tests/parse-events.c
author
#7 lore raw

PATCH 3/25 perf tests: Add framework for automated perf_event_attr tests

In reply to Jiri Olsa

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
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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
tools/perf/Makefile +1 -0
index 2d3427f..1da87a3 100644
@@ -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
tools/perf/perf.c +2 -0
index e968373..a0ae290 100644
@@ -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
tools/perf/perf.h +14 -2
index 469fbf2..0047264 100644
@@ -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
tools/perf/tests/attr.c new file +136 -0

136 lines not on this page · raw message

tools/perf/tests/attr.py new file +313 -0

313 lines not on this page · raw message

Signature · 1 line
1.7.11.7
author
#8 lore raw

Re: [PATCH 03/25] perf tests: Add framework for automated perf_event_attr tests

Quoted 83 lines · Jiri Olsa

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
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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
tools/perf/Makefile +1 -0
index 2d3427f..1da87a3 100644
@@ -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
tools/perf/perf.c +2 -0
index e968373..a0ae290 100644
@@ -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
tools/perf/perf.h +14 -2
index 469fbf2..0047264 100644
@@ -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;
 }
 

SNIP

tools/perf/perf.h

Quoted 7 lines
tools/perf/perf.h +7 -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");
+}

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

#9 lore raw

Re: [PATCH 03/25] perf tests: Add framework for automated perf_event_attr tests

Em Wed, Oct 31, 2012 at 12:01:20AM +0100, Jiri Olsa escreveu:

Quoted 15 lines · Jiri Olsa
Quoted 1 line

Adding automated test to check event's perf_event_attr values.

SNIP

tools/perf/tests/attr.c line 136

Quoted 7 lines
tools/perf/tests/attr.c new file +7 -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");
+}

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

Quoted 1 line

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

author
#10 lore raw

PATCH v2 3/25 perf tests: Add framework for automated perf_event_attr tests

Quoted 16 lines · Arnaldo Carvalho de Melo

Em Wed, Oct 31, 2012 at 12:01:20AM +0100, Jiri Olsa escreveu:

Quoted 15 lines · Jiri Olsa
Quoted 1 line

Adding automated test to check event's perf_event_attr values.

SNIP

Review

Quoted 7 lines
(quoted diff) +7 -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");
+}

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

Quoted 3 lines
Quoted 1 line

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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(-)
 create mode 100644 tools/perf/tests/attr.c
 create mode 100644 tools/perf/tests/attr.py
tools/perf/Makefile +1 -0
index 2d3427f..1da87a3 100644
@@ -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
tools/perf/perf.c +2 -0
index e968373..a0ae290 100644
@@ -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
tools/perf/perf.h +14 -2
index 469fbf2..0047264 100644
@@ -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
tools/perf/tests/attr.c new file +140 -0

140 lines not on this page · raw message

tools/perf/tests/attr.py new file +313 -0

313 lines not on this page · raw message

Signature · 1 line
1.7.11.7
maintainer
#11 lore raw

Re: [PATCHv2 03/25] perf tests: Add framework for automated perf_event_attr tests

Quoted 35 lines · Jiri Olsa

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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(-)
 create mode 100644 tools/perf/tests/attr.c
 create mode 100644 tools/perf/tests/attr.py
tools/perf/Makefile +0 -0
index 2d3427f..1da87a3 100644

tools/perf/Makefile LIB_OBJS += $(OUTPUT)arch/common.o · line 433

Quoted 4 lines
tools/perf/Makefile +1 -0
@@ -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

It'd better if it has more specific name like 'event-attr' but it'd not a big deal so no strong objection. :)

Quoted 3 lines
tools/perf/Makefile +0 -0
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
 BUILTIN_OBJS += $(OUTPUT)builtin-bench.o

[snip]

tools/perf/Makefile

Quoted 13 lines
tools/perf/Makefile +13 -0
+#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?

Quoted 59 lines
tools/perf/Makefile +59 -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);

tools/perf/Makefile

Quoted 10 lines
tools/perf/Makefile +10 -0
+	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);

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'.

Quoted 4 lines
tools/perf/Makefile +4 -0
+
+	fclose(file);
+	return 0;
+}

[snip]

tools/perf/Makefile

Quoted 12 lines
tools/perf/Makefile +12 -0
+    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.

Quoted 1 line

+

[snip]

Quoted 7 lines
tools/perf/Makefile +7 -0
+    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);

tools/perf/Makefile

Quoted 10 lines
tools/perf/Makefile +10 -0
+            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

author
#12 lore raw

Re: [PATCHv2 03/25] perf tests: Add framework for automated perf_event_attr tests

Quoted 17 lines · Namhyung Kim
Quoted 4 lines · Jiri Olsa

Adding automated test to check event's perf_event_attr values.

tools/perf/tests/attr.c new file +3 -0
+#define WRITE_ASS(str, fmt, data)					\
+do {									\
+	char buf[BUFSIZE];						\

tools/perf/tests/attr.c line 56

Quoted 10 lines
tools/perf/tests/attr.c new file +10 -0
+	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

Quoted 8 lines
Quoted 8 lines
tools/perf/tests/attr.c new file +7 -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];
+

SNIP

Quoted 10 lines

tools/perf/tests/attr.c line 125

Quoted 3 lines
tools/perf/tests/attr.c new file +3 -0
+	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

Quoted 34 lines
Quoted 5 lines
tools/perf/tests/attr.c new file +4 -0
+
+	fclose(file);
+	return 0;
+}

[snip]

tools/perf/tests/attr.py line 88

Quoted 12 lines
tools/perf/tests/attr.py new file +12 -0
+    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.

Quoted 1 line

+

[snip]

Quoted 11 lines
tools/perf/tests/attr.py new file +11 -0
+    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:]
Quoted 8 lines

tools/perf/tests/attr.py line 150

Quoted 6 lines
tools/perf/tests/attr.py new file +6 -0
+                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. :)

ok, will try ;)

thanks,
jirka

#13 lore raw

Re: [PATCHv2 03/25] perf tests: Add framework for automated perf_event_attr tests

Em Fri, Nov 02, 2012 at 11:40:52AM +0100, Jiri Olsa escreveu:

Quoted 7 lines · Namhyung Kim
Quoted 4 lines

tools/perf/tests/attr.py line 150

Quoted 2 lines
tools/perf/tests/attr.py new file +2 -0
+            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

author
#14 lore raw

Re: [PATCHv2 03/25] perf tests: Add framework for automated perf_event_attr tests

Quoted 10 lines · Arnaldo Carvalho de Melo

Em Fri, Nov 02, 2012 at 11:40:52AM +0100, Jiri Olsa escreveu:

Quoted 7 lines · Namhyung Kim
Quoted 4 lines

tools/perf/tests/attr.py line 150

Quoted 2 lines
tools/perf/tests/attr.py new file +2 -0
+            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

#15 lore raw

[tip:perf/core] perf tests: Add framework for automated perf_event_attr tests

In reply to Jiri Olsa
Commit-ID:  52502bf201a85b5b51a384037a002d0b39093df0
Gitweb:     http://git.kernel.org/tip/52502bf201a85b5b51a384037a002d0b39093df0
Author:     Jiri Olsa <[email protected]>
AuthorDate: Wed, 31 Oct 2012 15:52:47 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 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(-)
tools/perf/Makefile +1 -0
index 2d3427f..1da87a3 100644
@@ -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
tools/perf/perf.c +2 -0
index e968373..a0ae290 100644
@@ -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
tools/perf/perf.h +14 -2
index 469fbf2..0047264 100644
@@ -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
tools/perf/tests/attr.c new file +140 -0

140 lines not on this page · raw message

tools/perf/tests/attr.py new file +313 -0

313 lines not on this page · raw message

author
#16 lore raw

PATCH 4/25 perf tests: Add attr record basic test

In reply to Jiri Olsa

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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
tools/perf/tests/attr/base-record new file +40 -0
new file mode 100644
index 0000000..07beef5
@@ -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
tools/perf/tests/attr/test-record-basic new file +5 -0
new file mode 100644
index 0000000..55c0428
@@ -0,0 +1,5 @@
+[config]
+command = record
+args    = kill >/dev/null 2>&1
+
+[event:base-record]
Signature · 1 line
1.7.11.7
#17 lore raw

[tip:perf/core] perf tests: Add attr record basic test

Commit-ID:  bf779746f928de99eba84de0a72a5bbfa87ca680
Gitweb:     http://git.kernel.org/tip/bf779746f928de99eba84de0a72a5bbfa87ca680
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:01:45 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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'

---
 tools/perf/tests/attr/base-record       |   40 +++++++++++++++++++++++++++++++
 tools/perf/tests/attr/test-record-basic |    5 ++++
 2 files changed, 45 insertions(+), 0 deletions(-)
tools/perf/tests/attr/base-record new file +40 -0
new file mode 100644
index 0000000..07beef5
@@ -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
tools/perf/tests/attr/test-record-basic new file +5 -0
new file mode 100644
index 0000000..55c0428
@@ -0,0 +1,5 @@
+[config]
+command = record
+args    = kill >/dev/null 2>&1
+
+[event:base-record]
author
#18 lore raw

PATCH 5/25 perf tests: Add attr record group test

In reply to Jiri Olsa

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 tools/perf/tests/attr/test-record-group | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 tools/perf/tests/attr/test-record-group
tools/perf/tests/attr/test-record-group new file +17 -0
new file mode 100644
index 0000000..b945f77
@@ -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
Signature · 1 line
1.7.11.7
#19 lore raw

[tip:perf/core] perf tests: Add attr record group test

Commit-ID:  4f59de0bc6a545d730c054e765cf3e7de1f3cf4f
Gitweb:     http://git.kernel.org/tip/4f59de0bc6a545d730c054e765cf3e7de1f3cf4f
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:01:46 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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'

---
 tools/perf/tests/attr/test-record-group |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
tools/perf/tests/attr/test-record-group new file +17 -0
new file mode 100644
index 0000000..b945f77
@@ -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
author
#20 lore raw

PATCH 6/25 perf tests: Add attr record event syntax group test

In reply to Jiri Olsa

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 tools/perf/tests/attr/test-record-group1 | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 tools/perf/tests/attr/test-record-group1
tools/perf/tests/attr/test-record-group1 new file +20 -0
new file mode 100644
index 0000000..39bf860
@@ -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
Signature · 1 line
1.7.11.7
#21 lore raw

[tip:perf/core] perf tests: Add attr record event syntax group test

Commit-ID:  76062f61ff934ac9f22183c10494228852d26d47
Gitweb:     http://git.kernel.org/tip/76062f61ff934ac9f22183c10494228852d26d47
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:01:47 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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}'

---
 tools/perf/tests/attr/test-record-group1 |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
tools/perf/tests/attr/test-record-group1 new file +20 -0
new file mode 100644
index 0000000..39bf860
@@ -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
author
#22 lore raw

PATCH 7/25 perf tests: Add attr record freq test

In reply to Jiri Olsa

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 tools/perf/tests/attr/test-record-freq | 6 ++++++
 1 file changed, 6 insertions(+)
 create mode 100644 tools/perf/tests/attr/test-record-freq
tools/perf/tests/attr/test-record-freq new file +6 -0
new file mode 100644
index 0000000..600d0f8
@@ -0,0 +1,6 @@
+[config]
+command = record
+args    = -F 100 kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=100
Signature · 1 line
1.7.11.7
#23 lore raw

[tip:perf/core] perf tests: Add attr record freq test

Commit-ID:  44cfcf4cc6bcb67a01046f7f5c88187d1dafa775
Gitweb:     http://git.kernel.org/tip/44cfcf4cc6bcb67a01046f7f5c88187d1dafa775
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:01:48 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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'

---
 tools/perf/tests/attr/test-record-freq |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
tools/perf/tests/attr/test-record-freq new file +6 -0
new file mode 100644
index 0000000..600d0f8
@@ -0,0 +1,6 @@
+[config]
+command = record
+args    = -F 100 kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=100
author
#24 lore raw

PATCH 8/25 perf tests: Add attr record count test

In reply to Jiri Olsa

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 tools/perf/tests/attr/test-record-count | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 tools/perf/tests/attr/test-record-count
tools/perf/tests/attr/test-record-count new file +8 -0
new file mode 100644
index 0000000..2f841de
@@ -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
Signature · 1 line
1.7.11.7
#25 lore raw

[tip:perf/core] perf tests: Add attr record count test

Commit-ID:  a0f25be079ac10631e8e3a84a2fa8fb55c1e2a7f
Gitweb:     http://git.kernel.org/tip/a0f25be079ac10631e8e3a84a2fa8fb55c1e2a7f
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:01:49 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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'

---
 tools/perf/tests/attr/test-record-count |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
tools/perf/tests/attr/test-record-count new file +8 -0
new file mode 100644
index 0000000..2f841de
@@ -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
author
#26 lore raw

PATCH 9/25 perf tests: Add attr record graph test

In reply to Jiri Olsa

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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
tools/perf/tests/attr/test-record-graph-default new file +6 -0
new file mode 100644
index 0000000..833d184
@@ -0,0 +1,6 @@
+[config]
+command = record
+args    = -g -- kill >/dev/null 2>&1
+
+[event:base-record]
+sample_type=295
tools/perf/tests/attr/test-record-graph-dwarf new file +10 -0
new file mode 100644
index 0000000..e93e082
@@ -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=*
tools/perf/tests/attr/test-record-graph-fp new file +6 -0
new file mode 100644
index 0000000..7cef374
@@ -0,0 +1,6 @@
+[config]
+command = record
+args    = -g fp kill >/dev/null 2>&1
+
+[event:base-record]
+sample_type=295
Signature · 1 line
1.7.11.7
#27 lore raw

[tip:perf/core] perf tests: Add attr record graph test

Commit-ID:  8b96829468123431f925223f94a62b3372d8fd5e
Gitweb:     http://git.kernel.org/tip/8b96829468123431f925223f94a62b3372d8fd5e
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:01:50 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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

---
 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(-)
tools/perf/tests/attr/test-record-graph-default new file +6 -0
new file mode 100644
index 0000000..833d184
@@ -0,0 +1,6 @@
+[config]
+command = record
+args    = -g -- kill >/dev/null 2>&1
+
+[event:base-record]
+sample_type=295
tools/perf/tests/attr/test-record-graph-dwarf new file +10 -0
new file mode 100644
index 0000000..e93e082
@@ -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=*
tools/perf/tests/attr/test-record-graph-fp new file +6 -0
new file mode 100644
index 0000000..7cef374
@@ -0,0 +1,6 @@
+[config]
+command = record
+args    = -g fp kill >/dev/null 2>&1
+
+[event:base-record]
+sample_type=295
author
#28 lore raw

PATCH 10/25 perf tests: Add attr record period test

In reply to Jiri Olsa

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 tools/perf/tests/attr/test-record-period | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 tools/perf/tests/attr/test-record-period
tools/perf/tests/attr/test-record-period new file +7 -0
new file mode 100644
index 0000000..8abc531
@@ -0,0 +1,7 @@
+[config]
+command = record
+args    = -c 100 -P kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=100
+freq=0
Signature · 1 line
1.7.11.7
#29 lore raw

[tip:perf/core] perf tests: Add attr record period test

Commit-ID:  da98f8df49eb799b37587eb4a13ea7a1a9f9e47c
Gitweb:     http://git.kernel.org/tip/da98f8df49eb799b37587eb4a13ea7a1a9f9e47c
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:01:51 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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'

---
 .../attr/{test-record-freq => test-record-period}  |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
tools/perf/tests/attr/test-record-period renamed from tools/perf/tests/attr/test-record-freq +2 -1
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
@@ -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
author
#30 lore raw

PATCH 11/25 perf tests: Add attr record no samples test

In reply to Jiri Olsa

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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
tools/perf/tests/attr/test-record-no-samples new file +6 -0
new file mode 100644
index 0000000..d0141b2
@@ -0,0 +1,6 @@
+[config]
+command = record
+args    = -n kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=0
Signature · 1 line
1.7.11.7
#31 lore raw

[tip:perf/core] perf tests: Add attr record no samples test

Commit-ID:  55adeee3aaf745cc8b4e7c5976afbab95bde5697
Gitweb:     http://git.kernel.org/tip/55adeee3aaf745cc8b4e7c5976afbab95bde5697
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:01:52 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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'

---
 tools/perf/tests/attr/test-record-no-samples |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
tools/perf/tests/attr/test-record-no-samples new file +6 -0
new file mode 100644
index 0000000..d0141b2
@@ -0,0 +1,6 @@
+[config]
+command = record
+args    = -n kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=0
author
#32 lore raw

PATCH 12/25 perf tests: Add attr record no-inherit test

In reply to Jiri Olsa

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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
tools/perf/tests/attr/test-record-no-inherit new file +7 -0
new file mode 100644
index 0000000..9079a25
@@ -0,0 +1,7 @@
+[config]
+command = record
+args    = -i kill >/dev/null 2>&1
+
+[event:base-record]
+sample_type=259
+inherit=0
Signature · 1 line
1.7.11.7
#33 lore raw

[tip:perf/core] perf tests: Add attr record no-inherit test

Commit-ID:  0a3021c56b81eb3202a506e4d85cb8d99052f28f
Gitweb:     http://git.kernel.org/tip/0a3021c56b81eb3202a506e4d85cb8d99052f28f
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:01:53 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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'

---
 tools/perf/tests/attr/test-record-no-inherit |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
tools/perf/tests/attr/test-record-no-inherit new file +7 -0
new file mode 100644
index 0000000..9079a25
@@ -0,0 +1,7 @@
+[config]
+command = record
+args    = -i kill >/dev/null 2>&1
+
+[event:base-record]
+sample_type=259
+inherit=0
author
#34 lore raw

PATCH 13/25 perf tests: Add attr record data test

In reply to Jiri Olsa

From: "[email protected]" <[email protected]>

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 tools/perf/tests/attr/test-record-data | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 tools/perf/tests/attr/test-record-data
tools/perf/tests/attr/test-record-data new file +8 -0
new file mode 100644
index 0000000..6627c3e
@@ -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
Signature · 1 line
1.7.11.7
#35 lore raw

[tip:perf/core] perf tests: Add attr record data test

Commit-ID:  23823641ff8415ef500483af06a58069f7470d23
Gitweb:     http://git.kernel.org/tip/23823641ff8415ef500483af06a58069f7470d23
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:01:54 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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'

---
 tools/perf/tests/attr/test-record-data |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
tools/perf/tests/attr/test-record-data new file +8 -0
new file mode 100644
index 0000000..6627c3e
@@ -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
author
#36 lore raw

PATCH 14/25 perf tests: Add attr record raw test

In reply to Jiri Olsa

From: "[email protected]" <[email protected]>

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 tools/perf/tests/attr/test-record-raw | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 tools/perf/tests/attr/test-record-raw
tools/perf/tests/attr/test-record-raw new file +7 -0
new file mode 100644
index 0000000..4a8ef25
@@ -0,0 +1,7 @@
+[config]
+command = record
+args    = -R kill >/dev/null 2>&1
+
+[event:base-record]
+sample_period=4000
+sample_type=1415
Signature · 1 line
1.7.11.7
#37 lore raw

[tip:perf/core] perf tests: Add attr record raw test

Commit-ID:  813105858a85c9a98fc686fbe6788dc217cc9ab3
Gitweb:     http://git.kernel.org/tip/813105858a85c9a98fc686fbe6788dc217cc9ab3
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:01:55 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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'

---
 .../attr/{test-record-data => test-record-raw}     |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
tools/perf/tests/attr/test-record-raw renamed from tools/perf/tests/attr/test-record-data +2 -3
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
@@ -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
author
#38 lore raw

PATCH 15/25 perf tests: Add attr record no delay test

In reply to Jiri Olsa

From: "[email protected]" <[email protected]>

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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
tools/perf/tests/attr/test-record-no-delay new file +9 -0
new file mode 100644
index 0000000..f253b78
@@ -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
Signature · 1 line
1.7.11.7
#39 lore raw

[tip:perf/core] perf tests: Add attr record no delay test

Commit-ID:  f2e264ce36cbac642a63c23725da712bf00d508b
Gitweb:     http://git.kernel.org/tip/f2e264ce36cbac642a63c23725da712bf00d508b
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:01:56 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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'

---
 tools/perf/tests/attr/test-record-no-delay |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
tools/perf/tests/attr/test-record-no-delay new file +9 -0
new file mode 100644
index 0000000..f253b78
@@ -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
author
#40 lore raw

PATCH 16/25 perf tests: Add attr record branch any test

In reply to Jiri Olsa

From: "[email protected]" <[email protected]>

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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
tools/perf/tests/attr/test-record-branch-any new file +8 -0
new file mode 100644
index 0000000..1421960
@@ -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
Signature · 1 line
1.7.11.7
#41 lore raw

[tip:perf/core] perf tests: Add attr record branch any test

Commit-ID:  2fa10f2fe370f2da6c48dae5a154bfcd74848538
Gitweb:     http://git.kernel.org/tip/2fa10f2fe370f2da6c48dae5a154bfcd74848538
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:01:57 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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'

---
 tools/perf/tests/attr/test-record-branch-any |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
tools/perf/tests/attr/test-record-branch-any new file +8 -0
new file mode 100644
index 0000000..1421960
@@ -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
author
#42 lore raw

PATCH 17/25 perf tests: Add attr record branch filter tests

In reply to Jiri Olsa

From: "[email protected]" <[email protected]>

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'

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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
tools/perf/tests/attr/test-record-branch-filter-any new file +8 -0
new file mode 100644
index 0000000..915c4df
@@ -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
tools/perf/tests/attr/test-record-branch-filter-any_call new file +8 -0
new file mode 100644
index 0000000..8708dbd
@@ -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
tools/perf/tests/attr/test-record-branch-filter-any_ret new file +8 -0
new file mode 100644
index 0000000..0d3607a
@@ -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
tools/perf/tests/attr/test-record-branch-filter-hv new file +8 -0
new file mode 100644
index 0000000..f255267
@@ -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
tools/perf/tests/attr/test-record-branch-filter-ind_call new file +8 -0
new file mode 100644
index 0000000..e862dd1
@@ -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
tools/perf/tests/attr/test-record-branch-filter-k new file +8 -0
new file mode 100644
index 0000000..182971e
@@ -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
tools/perf/tests/attr/test-record-branch-filter-u new file +8 -0
new file mode 100644
index 0000000..83449ef
@@ -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
Signature · 1 line
1.7.11.7
#43 lore raw

[tip:perf/core] perf tests: Add attr record branch filter tests

Commit-ID:  9c90178412813368b7f040793c4af2fdfed3634d
Gitweb:     http://git.kernel.org/tip/9c90178412813368b7f040793c4af2fdfed3634d
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:01:58 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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'

---
 .../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(-)
tools/perf/tests/attr/test-record-branch-filter-any new file +8 -0
new file mode 100644
index 0000000..915c4df
@@ -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
tools/perf/tests/attr/test-record-branch-filter-any_call new file +8 -0
new file mode 100644
index 0000000..8708dbd
@@ -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
tools/perf/tests/attr/test-record-branch-filter-any_ret new file +8 -0
new file mode 100644
index 0000000..0d3607a
@@ -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
tools/perf/tests/attr/test-record-branch-filter-hv new file +8 -0
new file mode 100644
index 0000000..f255267
@@ -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
tools/perf/tests/attr/test-record-branch-filter-ind_call new file +8 -0
new file mode 100644
index 0000000..e862dd1
@@ -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
tools/perf/tests/attr/test-record-branch-filter-k new file +8 -0
new file mode 100644
index 0000000..182971e
@@ -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
tools/perf/tests/attr/test-record-branch-filter-u new file +8 -0
new file mode 100644
index 0000000..83449ef
@@ -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
author
#44 lore raw

PATCH 18/25 perf tests: Add attr stat basic test

In reply to Jiri Olsa

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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
tools/perf/tests/attr/base-stat new file +40 -0
new file mode 100644
index 0000000..6e1bb8e
@@ -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
tools/perf/tests/attr/test-stat-basic new file +6 -0
new file mode 100644
index 0000000..74e1788
@@ -0,0 +1,6 @@
+[config]
+command = stat
+args    = -e cycles kill >/dev/null 2>&1
+ret     = 1
+
+[event:base-stat]
Signature · 1 line
1.7.11.7
author
#45 lore raw

PATCH 19/25 perf tests: Add attr stat no-inherit test

In reply to Jiri Olsa

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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
tools/perf/tests/attr/test-stat-no-inherit new file +7 -0
new file mode 100644
index 0000000..d54b2a1e
@@ -0,0 +1,7 @@
+[config]
+command = stat
+args    = -i -e cycles kill >/dev/null 2>&1
+ret     = 1
+
+[event:base-stat]
+inherit=0
Signature · 1 line
1.7.11.7
#46 lore raw

[tip:perf/core] perf tests: Add attr stat no-inherit test

Commit-ID:  9602681f705830955eff1c2dd18283e5a01be58c
Gitweb:     http://git.kernel.org/tip/9602681f705830955eff1c2dd18283e5a01be58c
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:02:00 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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'

---
 tools/perf/tests/attr/test-stat-no-inherit |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
tools/perf/tests/attr/test-stat-no-inherit new file +7 -0
new file mode 100644
index 0000000..d54b2a1e
@@ -0,0 +1,7 @@
+[config]
+command = stat
+args    = -i -e cycles kill >/dev/null 2>&1
+ret     = 1
+
+[event:base-stat]
+inherit=0
author
#47 lore raw

PATCH 20/25 perf tests: Add attr stat group test

In reply to Jiri Olsa

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 tools/perf/tests/attr/test-stat-group | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 tools/perf/tests/attr/test-stat-group
tools/perf/tests/attr/test-stat-group new file +15 -0
new file mode 100644
index 0000000..fdc1596
@@ -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
Signature · 1 line
1.7.11.7
#48 lore raw

[tip:perf/core] perf tests: Add attr stat group test

Commit-ID:  a6d3476c58763b35104d815757faed5bdf040cea
Gitweb:     http://git.kernel.org/tip/a6d3476c58763b35104d815757faed5bdf040cea
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:02:01 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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'

---
 .../attr/{test-record-group => test-stat-group}    |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)
tools/perf/tests/attr/test-stat-group renamed from tools/perf/tests/attr/test-record-group +5 -7
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
@@ -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
author
#49 lore raw

PATCH 21/25 perf tests: Add attr stat event syntax group test

In reply to Jiri Olsa

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 tools/perf/tests/attr/test-stat-group1 | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 tools/perf/tests/attr/test-stat-group1
tools/perf/tests/attr/test-stat-group1 new file +17 -0
new file mode 100644
index 0000000..5ae2718
@@ -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
Signature · 1 line
1.7.11.7
#50 lore raw

[tip:perf/core] perf tests: Add attr stat event syntax group test

Commit-ID:  28ae79cfb622cf471d45f1b3f38609d8766e8a95
Gitweb:     http://git.kernel.org/tip/28ae79cfb622cf471d45f1b3f38609d8766e8a95
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:02:02 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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}'

---
 tools/perf/tests/attr/test-stat-group1 |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
tools/perf/tests/attr/test-stat-group1 new file +17 -0
new file mode 100644
index 0000000..5ae2718
@@ -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
author
#51 lore raw

PATCH 22/25 perf tests: Add attr stat default test

In reply to Jiri Olsa

From: "[email protected]" <[email protected]>

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 tools/perf/tests/attr/test-stat-default | 64 +++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 tools/perf/tests/attr/test-stat-default
tools/perf/tests/attr/test-stat-default new file +64 -0
new file mode 100644
index 0000000..19270f5
@@ -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
Signature · 1 line
1.7.11.7
#52 lore raw

[tip:perf/core] perf tests: Add attr stat default test

Commit-ID:  149960a0dd4222fbd6678876c005b8b1c85f8e6a
Gitweb:     http://git.kernel.org/tip/149960a0dd4222fbd6678876c005b8b1c85f8e6a
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:02:03 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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'

---
 tools/perf/tests/attr/test-stat-default |   64 +++++++++++++++++++++++++++++++
 1 files changed, 64 insertions(+), 0 deletions(-)
tools/perf/tests/attr/test-stat-default new file +64 -0
new file mode 100644
index 0000000..19270f5
@@ -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
author
#53 lore raw

PATCH 23/25 perf tests: Add attr stat default test

In reply to Jiri Olsa

From: "[email protected]" <[email protected]>

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

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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
tools/perf/tests/attr/test-stat-detailed-1 new file +101 -0
new file mode 100644
index 0000000..51426b8
@@ -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
tools/perf/tests/attr/test-stat-detailed-2 new file +155 -0

155 lines not on this page · raw message

tools/perf/tests/attr/test-stat-detailed-3 new file +173 -0

173 lines not on this page · raw message

Signature · 1 line
1.7.11.7
#54 lore raw

[tip:perf/core] perf tests: Add attr stat default test

Commit-ID:  8a6408a04bf98c853a047412f20f9c73669058be
Gitweb:     http://git.kernel.org/tip/8a6408a04bf98c853a047412f20f9c73669058be
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:02:04 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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'

---
 .../{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(-)
tools/perf/tests/attr/test-stat-detailed-1 renamed from tools/perf/tests/attr/test-stat-default +38 -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
@@ -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
tools/perf/tests/attr/test-stat-detailed-2 new file +155 -0

155 lines not on this page · raw message

tools/perf/tests/attr/test-stat-detailed-3 new file +173 -0

173 lines not on this page · raw message

author
#55 lore raw

PATCH 24/25 perf tests: Add attr tests under builtin test command

In reply to Jiri Olsa

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.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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(+)
tools/perf/Makefile +9 -0
index 1da87a3..ba380b9 100644
@@ -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)'
tools/perf/perf.h +1 -0
index 0047264..054182e 100644
@@ -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,
tools/perf/tests/attr.c +35 -0
index 2fe8cae..ef2505e 100644
@@ -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;
+}
tools/perf/tests/builtin-test.c +4 -0
index a04276e..8e2e7d6 100644
@@ -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,
 	},
 };
Signature · 1 line
1.7.11.7
#56 lore raw

[tip:perf/core] perf tests: Add attr tests under builtin test command

Commit-ID:  d898b241215daf6f2e654b32ebb8341bffc98cc5
Gitweb:     http://git.kernel.org/tip/d898b241215daf6f2e654b32ebb8341bffc98cc5
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:02:05 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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.

---
 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(-)
tools/perf/Makefile +9 -0
index 1da87a3..4ffcd02 100644
@@ -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)'
tools/perf/perf.h +1 -0
index 0047264..054182e 100644
@@ -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,
tools/perf/tests/attr.c +35 -0
index 55e9a87..aacad82 100644
@@ -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;
+}
tools/perf/tests/builtin-test.c +4 -0
index f6c6424..1aa9e99 100644
@@ -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,
 	},
 };
author
#57 lore raw

PATCH 25/25 perf tests: Add documentation for attr tests

In reply to Jiri Olsa

Adding documentation for attr tests.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 tools/perf/tests/attr/README | 64 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 tools/perf/tests/attr/README
tools/perf/tests/attr/README new file +64 -0
new file mode 100644
index 0000000..d102957
@@ -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)
Signature · 1 line
1.7.11.7
#58 lore raw

[tip:perf/core] perf tests: Add documentation for attr tests

Commit-ID:  b84800a31502ab75c0032192de01e61a0d517f38
Gitweb:     http://git.kernel.org/tip/b84800a31502ab75c0032192de01e61a0d517f38
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 30 Oct 2012 23:02:06 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 5 Nov 2012 14:03:58 -0300

perf tests: Add documentation for attr tests

Adding documentation for attr tests.

---
 tools/perf/tests/attr/README |   64 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 64 insertions(+), 0 deletions(-)
tools/perf/tests/attr/README new file +64 -0
new file mode 100644
index 0000000..d102957
@@ -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)
#59 lore raw
In reply to Jiri Olsa

Em Tue, Oct 30, 2012 at 11:01:41PM +0100, Jiri Olsa escreveu:

Quoted 6 lines

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

author
#60 lore raw
Quoted 28 lines · Arnaldo Carvalho de Melo

Em Tue, Oct 30, 2012 at 11:01:41PM +0100, Jiri Olsa escreveu:

Quoted 6 lines

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:

Quoted 8 lines

[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 ~]#

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 ;)

Quoted 4 lines

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

Quoted 2 lines

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

thanks,
jirka

maintainer
#61 lore raw

Hi,

Quoted 5 lines · Jiri Olsa
Quoted 1 line · Arnaldo Carvalho de Melo

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

maintainer
#62 lore raw
Quoted 10 lines · Namhyung Kim
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

Quoted 8 lines

[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

Thanks,
Namhyung