* [PATCH 0/3] perf tool: Add support for wildcard in tracepoint system name
@ 2012-12-17 13:08 Jiri Olsa
2012-12-17 13:08 ` [PATCH 1/3] perf tools: Add missing closedir in multi tracepoint processing Jiri Olsa
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Jiri Olsa @ 2012-12-17 13:08 UTC (permalink / raw)
To: linux-kernel
Cc: Arnaldo Carvalho de Melo, Namhyung Kim, Corey Ashford,
Frederic Weisbecker, Ingo Molnar, Paul Mackerras, Peter Zijlstra
hi,
Attached patches:
1/3 perf tools: Add missing closedir in multi tracepoint processing
2/3 perf tools: Add support for wildcard in tracepoint system name
3/3 perf tests: Add event parsing test for '*:*' tracepoints
The automated test (patch 3) exposes warnings from traceevent lib about
not being able to parse some tracepoints' format data. Exposing these
messages in the automated test suite will probably speed up the fix ;-)
I've already talked to Steve about the solution. Additional parsing
plugins need to be added (some moved from trace-cmd) into traceevent
lib.
thanks,
jirka
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
tools/perf/tests/parse-events.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/perf/util/parse-events.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 109 insertions(+), 5 deletions(-)
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 1/3] perf tools: Add missing closedir in multi tracepoint processing 2012-12-17 13:08 [PATCH 0/3] perf tool: Add support for wildcard in tracepoint system name Jiri Olsa @ 2012-12-17 13:08 ` Jiri Olsa 2013-01-25 11:01 ` [tip:perf/core] " tip-bot for Jiri Olsa 2012-12-17 13:08 ` [PATCH 2/3] perf tools: Add support for wildcard in tracepoint system name Jiri Olsa 2012-12-17 13:08 ` [PATCH 3/3] perf tests: Add event parsing test for '*:*' tracepoints Jiri Olsa 2 siblings, 1 reply; 9+ messages in thread From: Jiri Olsa @ 2012-12-17 13:08 UTC (permalink / raw) To: linux-kernel Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Namhyung Kim, Corey Ashford, Frederic Weisbecker, Ingo Molnar, Paul Mackerras, Peter Zijlstra We don't close 'events' directory when reading multiple tracepoint events. Adding missing closedir. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> --- tools/perf/util/parse-events.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 2d8d53be..d64ff29 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -408,6 +408,7 @@ static int add_tracepoint_multi(struct list_head **list, int *idx, ret = add_tracepoint(list, idx, sys_name, evt_ent->d_name); } + closedir(evt_dir); return ret; } -- 1.7.11.7 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [tip:perf/core] perf tools: Add missing closedir in multi tracepoint processing 2012-12-17 13:08 ` [PATCH 1/3] perf tools: Add missing closedir in multi tracepoint processing Jiri Olsa @ 2013-01-25 11:01 ` tip-bot for Jiri Olsa 0 siblings, 0 replies; 9+ messages in thread From: tip-bot for Jiri Olsa @ 2013-01-25 11:01 UTC (permalink / raw) To: linux-tip-commits Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, namhyung, jolsa, fweisbec, tglx, cjashfor, mingo Commit-ID: 0bd3f0840bf4bc900b4beb8e792ad499b43dad3b Gitweb: http://git.kernel.org/tip/0bd3f0840bf4bc900b4beb8e792ad499b43dad3b Author: Jiri Olsa <jolsa@redhat.com> AuthorDate: Mon, 17 Dec 2012 14:08:36 +0100 Committer: Arnaldo Carvalho de Melo <acme@redhat.com> CommitDate: Thu, 24 Jan 2013 16:40:10 -0300 perf tools: Add missing closedir in multi tracepoint processing We don't close 'events' directory when reading multiple tracepoint events. Adding missing closedir. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1355749718-4355-2-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> --- tools/perf/util/parse-events.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 2d8d53be..d64ff29 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -408,6 +408,7 @@ static int add_tracepoint_multi(struct list_head **list, int *idx, ret = add_tracepoint(list, idx, sys_name, evt_ent->d_name); } + closedir(evt_dir); return ret; } ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] perf tools: Add support for wildcard in tracepoint system name 2012-12-17 13:08 [PATCH 0/3] perf tool: Add support for wildcard in tracepoint system name Jiri Olsa 2012-12-17 13:08 ` [PATCH 1/3] perf tools: Add missing closedir in multi tracepoint processing Jiri Olsa @ 2012-12-17 13:08 ` Jiri Olsa 2013-01-25 11:02 ` [tip:perf/core] " tip-bot for Jiri Olsa 2012-12-17 13:08 ` [PATCH 3/3] perf tests: Add event parsing test for '*:*' tracepoints Jiri Olsa 2 siblings, 1 reply; 9+ messages in thread From: Jiri Olsa @ 2012-12-17 13:08 UTC (permalink / raw) To: linux-kernel Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Namhyung Kim, Corey Ashford, Frederic Weisbecker, Ingo Molnar, Paul Mackerras, Peter Zijlstra Adding support for wildcards '*?" in the tracepoint system part. It's now possible to open all available tracepoints like: # perf stat -e '*:*' ls You might need to increase limit for open files via ulimit. If ftrace events tracepoints are configured in, the record command fails on above event selection because of them. The stat command disables counters that fails to open, the record command fails completely. We probably want to be smarter here. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> --- tools/perf/util/parse-events.c | 51 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index d64ff29..626c120 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -380,8 +380,8 @@ static int add_tracepoint(struct list_head **listp, int *idx, return 0; } -static int add_tracepoint_multi(struct list_head **list, int *idx, - char *sys_name, char *evt_name) +static int add_tracepoint_multi_event(struct list_head **list, int *idx, + char *sys_name, char *evt_name) { char evt_path[MAXPATHLEN]; struct dirent *evt_ent; @@ -412,6 +412,46 @@ static int add_tracepoint_multi(struct list_head **list, int *idx, return ret; } +static int add_tracepoint_event(struct list_head **list, int *idx, + char *sys_name, char *evt_name) +{ + return strpbrk(evt_name, "*?") ? + add_tracepoint_multi_event(list, idx, sys_name, evt_name) : + add_tracepoint(list, idx, sys_name, evt_name); +} + +static int add_tracepoint_multi_sys(struct list_head **list, int *idx, + char *sys_name, char *evt_name) +{ + struct dirent *events_ent; + DIR *events_dir; + int ret = 0; + + events_dir = opendir(tracing_events_path); + if (!events_dir) { + perror("Can't open event dir"); + return -1; + } + + while (!ret && (events_ent = readdir(events_dir))) { + if (!strcmp(events_ent->d_name, ".") + || !strcmp(events_ent->d_name, "..") + || !strcmp(events_ent->d_name, "enable") + || !strcmp(events_ent->d_name, "header_event") + || !strcmp(events_ent->d_name, "header_page")) + continue; + + if (!strglobmatch(events_ent->d_name, sys_name)) + continue; + + ret = add_tracepoint_event(list, idx, events_ent->d_name, + evt_name); + } + + closedir(events_dir); + return ret; +} + int parse_events_add_tracepoint(struct list_head **list, int *idx, char *sys, char *event) { @@ -421,9 +461,10 @@ int parse_events_add_tracepoint(struct list_head **list, int *idx, if (ret) return ret; - return strpbrk(event, "*?") ? - add_tracepoint_multi(list, idx, sys, event) : - add_tracepoint(list, idx, sys, event); + if (strpbrk(sys, "*?")) + return add_tracepoint_multi_sys(list, idx, sys, event); + else + return add_tracepoint_event(list, idx, sys, event); } static int -- 1.7.11.7 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [tip:perf/core] perf tools: Add support for wildcard in tracepoint system name 2012-12-17 13:08 ` [PATCH 2/3] perf tools: Add support for wildcard in tracepoint system name Jiri Olsa @ 2013-01-25 11:02 ` tip-bot for Jiri Olsa 0 siblings, 0 replies; 9+ messages in thread From: tip-bot for Jiri Olsa @ 2013-01-25 11:02 UTC (permalink / raw) To: linux-tip-commits Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, namhyung, jolsa, fweisbec, tglx, cjashfor, mingo Commit-ID: f35488f97b4b49cb76d87bb7e8da9e93fc70b4e9 Gitweb: http://git.kernel.org/tip/f35488f97b4b49cb76d87bb7e8da9e93fc70b4e9 Author: Jiri Olsa <jolsa@redhat.com> AuthorDate: Mon, 17 Dec 2012 14:08:37 +0100 Committer: Arnaldo Carvalho de Melo <acme@redhat.com> CommitDate: Thu, 24 Jan 2013 16:40:10 -0300 perf tools: Add support for wildcard in tracepoint system name Adding support for wildcards '*?" in the tracepoint system part. It's now possible to open all available tracepoints like: # perf stat -e '*:*' ls You might need to increase limit for open files via ulimit. If ftrace events tracepoints are configured in, the record command fails on above event selection because of them. The stat command disables counters that fails to open, the record command fails completely. We probably want to be smarter here. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1355749718-4355-3-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> --- tools/perf/util/parse-events.c | 51 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index d64ff29..626c120 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -380,8 +380,8 @@ static int add_tracepoint(struct list_head **listp, int *idx, return 0; } -static int add_tracepoint_multi(struct list_head **list, int *idx, - char *sys_name, char *evt_name) +static int add_tracepoint_multi_event(struct list_head **list, int *idx, + char *sys_name, char *evt_name) { char evt_path[MAXPATHLEN]; struct dirent *evt_ent; @@ -412,6 +412,46 @@ static int add_tracepoint_multi(struct list_head **list, int *idx, return ret; } +static int add_tracepoint_event(struct list_head **list, int *idx, + char *sys_name, char *evt_name) +{ + return strpbrk(evt_name, "*?") ? + add_tracepoint_multi_event(list, idx, sys_name, evt_name) : + add_tracepoint(list, idx, sys_name, evt_name); +} + +static int add_tracepoint_multi_sys(struct list_head **list, int *idx, + char *sys_name, char *evt_name) +{ + struct dirent *events_ent; + DIR *events_dir; + int ret = 0; + + events_dir = opendir(tracing_events_path); + if (!events_dir) { + perror("Can't open event dir"); + return -1; + } + + while (!ret && (events_ent = readdir(events_dir))) { + if (!strcmp(events_ent->d_name, ".") + || !strcmp(events_ent->d_name, "..") + || !strcmp(events_ent->d_name, "enable") + || !strcmp(events_ent->d_name, "header_event") + || !strcmp(events_ent->d_name, "header_page")) + continue; + + if (!strglobmatch(events_ent->d_name, sys_name)) + continue; + + ret = add_tracepoint_event(list, idx, events_ent->d_name, + evt_name); + } + + closedir(events_dir); + return ret; +} + int parse_events_add_tracepoint(struct list_head **list, int *idx, char *sys, char *event) { @@ -421,9 +461,10 @@ int parse_events_add_tracepoint(struct list_head **list, int *idx, if (ret) return ret; - return strpbrk(event, "*?") ? - add_tracepoint_multi(list, idx, sys, event) : - add_tracepoint(list, idx, sys, event); + if (strpbrk(sys, "*?")) + return add_tracepoint_multi_sys(list, idx, sys, event); + else + return add_tracepoint_event(list, idx, sys, event); } static int ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] perf tests: Add event parsing test for '*:*' tracepoints 2012-12-17 13:08 [PATCH 0/3] perf tool: Add support for wildcard in tracepoint system name Jiri Olsa 2012-12-17 13:08 ` [PATCH 1/3] perf tools: Add missing closedir in multi tracepoint processing Jiri Olsa 2012-12-17 13:08 ` [PATCH 2/3] perf tools: Add support for wildcard in tracepoint system name Jiri Olsa @ 2012-12-17 13:08 ` Jiri Olsa 2012-12-18 17:35 ` Arnaldo Carvalho de Melo 2013-01-25 11:03 ` [tip:perf/core] " tip-bot for Jiri Olsa 2 siblings, 2 replies; 9+ messages in thread From: Jiri Olsa @ 2012-12-17 13:08 UTC (permalink / raw) To: linux-kernel Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Namhyung Kim, Corey Ashford, Frederic Weisbecker, Ingo Molnar, Paul Mackerras, Peter Zijlstra Adding event parsing test for '*:*' tracepoints. Checking the count matches all the tracepoints available plus current standard tracepoint perf_event_attr check. This test exposes warnings from traceevent lib about not being able to parse some tracepoints' format data. Exposing these messages in the automated test suite will probably speed up the fix ;-) Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> --- tools/perf/tests/parse-events.c | 62 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index 294ffdd..e7eb708 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c @@ -3,6 +3,7 @@ #include "evsel.h" #include "evlist.h" #include "sysfs.h" +#include "debugfs.h" #include "tests.h" #include <linux/hw_breakpoint.h> @@ -782,6 +783,63 @@ static int test__group5(struct perf_evlist *evlist __maybe_unused) return 0; } +static int count_tracepoints(void) +{ + char events_path[PATH_MAX]; + struct dirent *events_ent; + DIR *events_dir; + int cnt = 0; + + scnprintf(events_path, PATH_MAX, "%s/tracing/events", + debugfs_find_mountpoint()); + + events_dir = opendir(events_path); + + TEST_ASSERT_VAL("Can't open events dir", events_dir); + + while ((events_ent = readdir(events_dir))) { + char sys_path[PATH_MAX]; + struct dirent *sys_ent; + DIR *sys_dir; + + if (!strcmp(events_ent->d_name, ".") + || !strcmp(events_ent->d_name, "..") + || !strcmp(events_ent->d_name, "enable") + || !strcmp(events_ent->d_name, "header_event") + || !strcmp(events_ent->d_name, "header_page")) + continue; + + scnprintf(sys_path, PATH_MAX, "%s/%s", + events_path, events_ent->d_name); + + sys_dir = opendir(sys_path); + TEST_ASSERT_VAL("Can't open sys dir", sys_dir); + + while ((sys_ent = readdir(sys_dir))) { + if (!strcmp(sys_ent->d_name, ".") + || !strcmp(sys_ent->d_name, "..") + || !strcmp(sys_ent->d_name, "enable") + || !strcmp(sys_ent->d_name, "filter")) + continue; + + cnt++; + } + + closedir(sys_dir); + } + + closedir(events_dir); + return cnt; +} + +static int test__all_tracepoints(struct perf_evlist *evlist) +{ + TEST_ASSERT_VAL("wrong events count", + count_tracepoints() == evlist->nr_entries); + + return test__checkevent_tracepoint_multi(evlist); +} + struct test__event_st { const char *name; __u32 type; @@ -921,6 +979,10 @@ static struct test__event_st test__events[] = { .name = "{cycles,instructions}:G,{cycles:G,instructions:G},cycles", .check = test__group5, }, + [33] = { + .name = "*:*", + .check = test__all_tracepoints, + }, }; static struct test__event_st test__events_pmu[] = { -- 1.7.11.7 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] perf tests: Add event parsing test for '*:*' tracepoints 2012-12-17 13:08 ` [PATCH 3/3] perf tests: Add event parsing test for '*:*' tracepoints Jiri Olsa @ 2012-12-18 17:35 ` Arnaldo Carvalho de Melo 2012-12-19 0:43 ` Jiri Olsa 2013-01-25 11:03 ` [tip:perf/core] " tip-bot for Jiri Olsa 1 sibling, 1 reply; 9+ messages in thread From: Arnaldo Carvalho de Melo @ 2012-12-18 17:35 UTC (permalink / raw) To: Jiri Olsa Cc: linux-kernel, Namhyung Kim, Corey Ashford, Frederic Weisbecker, Ingo Molnar, Paul Mackerras, Peter Zijlstra Em Mon, Dec 17, 2012 at 02:08:38PM +0100, Jiri Olsa escreveu: > Adding event parsing test for '*:*' tracepoints. Checking the > count matches all the tracepoints available plus current > standard tracepoint perf_event_attr check. > > This test exposes warnings from traceevent lib about not being > able to parse some tracepoints' format data. Exposing these > messages in the automated test suite will probably speed up > the fix ;-) Ok, merged, now where is that speedup? ;-) - Arnaldo ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] perf tests: Add event parsing test for '*:*' tracepoints 2012-12-18 17:35 ` Arnaldo Carvalho de Melo @ 2012-12-19 0:43 ` Jiri Olsa 0 siblings, 0 replies; 9+ messages in thread From: Jiri Olsa @ 2012-12-19 0:43 UTC (permalink / raw) To: Arnaldo Carvalho de Melo Cc: linux-kernel, Namhyung Kim, Corey Ashford, Frederic Weisbecker, Ingo Molnar, Paul Mackerras, Peter Zijlstra On Tue, Dec 18, 2012 at 02:35:50PM -0300, Arnaldo Carvalho de Melo wrote: > Em Mon, Dec 17, 2012 at 02:08:38PM +0100, Jiri Olsa escreveu: > > Adding event parsing test for '*:*' tracepoints. Checking the > > count matches all the tracepoints available plus current > > standard tracepoint perf_event_attr check. > > > > This test exposes warnings from traceevent lib about not being > > able to parse some tracepoints' format data. Exposing these > > messages in the automated test suite will probably speed up > > the fix ;-) > > Ok, merged, now where is that speedup? ;-) well.. I did say 'probably' ;-) thanks, jirka ^ permalink raw reply [flat|nested] 9+ messages in thread
* [tip:perf/core] perf tests: Add event parsing test for '*:*' tracepoints 2012-12-17 13:08 ` [PATCH 3/3] perf tests: Add event parsing test for '*:*' tracepoints Jiri Olsa 2012-12-18 17:35 ` Arnaldo Carvalho de Melo @ 2013-01-25 11:03 ` tip-bot for Jiri Olsa 1 sibling, 0 replies; 9+ messages in thread From: tip-bot for Jiri Olsa @ 2013-01-25 11:03 UTC (permalink / raw) To: linux-tip-commits Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, namhyung, jolsa, fweisbec, tglx, cjashfor, mingo Commit-ID: 82ce75d93335f7079afc17fb7f2a4e549d2fbecb Gitweb: http://git.kernel.org/tip/82ce75d93335f7079afc17fb7f2a4e549d2fbecb Author: Jiri Olsa <jolsa@redhat.com> AuthorDate: Mon, 17 Dec 2012 14:08:38 +0100 Committer: Arnaldo Carvalho de Melo <acme@redhat.com> CommitDate: Thu, 24 Jan 2013 16:40:10 -0300 perf tests: Add event parsing test for '*:*' tracepoints Adding event parsing test for '*:*' tracepoints. Checking the count matches all the tracepoints available plus current standard tracepoint perf_event_attr check. This test exposes warnings from traceevent lib about not being able to parse some tracepoints' format data. Exposing these messages in the automated test suite will probably speed up the fix ;-) Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1355749718-4355-4-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> --- tools/perf/tests/parse-events.c | 62 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index 294ffdd..e7eb708 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c @@ -3,6 +3,7 @@ #include "evsel.h" #include "evlist.h" #include "sysfs.h" +#include "debugfs.h" #include "tests.h" #include <linux/hw_breakpoint.h> @@ -782,6 +783,63 @@ static int test__group5(struct perf_evlist *evlist __maybe_unused) return 0; } +static int count_tracepoints(void) +{ + char events_path[PATH_MAX]; + struct dirent *events_ent; + DIR *events_dir; + int cnt = 0; + + scnprintf(events_path, PATH_MAX, "%s/tracing/events", + debugfs_find_mountpoint()); + + events_dir = opendir(events_path); + + TEST_ASSERT_VAL("Can't open events dir", events_dir); + + while ((events_ent = readdir(events_dir))) { + char sys_path[PATH_MAX]; + struct dirent *sys_ent; + DIR *sys_dir; + + if (!strcmp(events_ent->d_name, ".") + || !strcmp(events_ent->d_name, "..") + || !strcmp(events_ent->d_name, "enable") + || !strcmp(events_ent->d_name, "header_event") + || !strcmp(events_ent->d_name, "header_page")) + continue; + + scnprintf(sys_path, PATH_MAX, "%s/%s", + events_path, events_ent->d_name); + + sys_dir = opendir(sys_path); + TEST_ASSERT_VAL("Can't open sys dir", sys_dir); + + while ((sys_ent = readdir(sys_dir))) { + if (!strcmp(sys_ent->d_name, ".") + || !strcmp(sys_ent->d_name, "..") + || !strcmp(sys_ent->d_name, "enable") + || !strcmp(sys_ent->d_name, "filter")) + continue; + + cnt++; + } + + closedir(sys_dir); + } + + closedir(events_dir); + return cnt; +} + +static int test__all_tracepoints(struct perf_evlist *evlist) +{ + TEST_ASSERT_VAL("wrong events count", + count_tracepoints() == evlist->nr_entries); + + return test__checkevent_tracepoint_multi(evlist); +} + struct test__event_st { const char *name; __u32 type; @@ -921,6 +979,10 @@ static struct test__event_st test__events[] = { .name = "{cycles,instructions}:G,{cycles:G,instructions:G},cycles", .check = test__group5, }, + [33] = { + .name = "*:*", + .check = test__all_tracepoints, + }, }; static struct test__event_st test__events_pmu[] = { ^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-01-25 11:04 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-12-17 13:08 [PATCH 0/3] perf tool: Add support for wildcard in tracepoint system name Jiri Olsa 2012-12-17 13:08 ` [PATCH 1/3] perf tools: Add missing closedir in multi tracepoint processing Jiri Olsa 2013-01-25 11:01 ` [tip:perf/core] " tip-bot for Jiri Olsa 2012-12-17 13:08 ` [PATCH 2/3] perf tools: Add support for wildcard in tracepoint system name Jiri Olsa 2013-01-25 11:02 ` [tip:perf/core] " tip-bot for Jiri Olsa 2012-12-17 13:08 ` [PATCH 3/3] perf tests: Add event parsing test for '*:*' tracepoints Jiri Olsa 2012-12-18 17:35 ` Arnaldo Carvalho de Melo 2012-12-19 0:43 ` Jiri Olsa 2013-01-25 11:03 ` [tip:perf/core] " tip-bot for Jiri Olsa
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox